Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add command type in resolvedUserConfig #2042

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions examples/arco-pro/farm.config.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import { resolve } from 'node:path';
import { defineConfig } from '@farmfe/core';
import farmJsPluginLess from '@farmfe/js-plugin-less';
import { resolve } from "node:path";
import { defineConfig } from "@farmfe/core";
import farmJsPluginLess from "@farmfe/js-plugin-less";

export default defineConfig((env) => {
return {
compilation: {
resolve: {
alias: {
'@': resolve(process.cwd(), './src'),
'react-dom': resolve(process.cwd(), './node_modules/react-dom'),
react: resolve(process.cwd(), './node_modules/react')
}
"@": resolve(process.cwd(), "./src"),
},
dedupe: ["react", "react-dom"],
},
},
plugins: [
'@farmfe/plugin-react',
'@farmfe/plugin-svgr',
"@farmfe/plugin-react",
"@farmfe/plugin-svgr",
farmJsPluginLess(),
]
],
};
});
3 changes: 2 additions & 1 deletion packages/core/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface ConfigEnv {
isPreview: boolean;
}

export type commandType = 'start' | 'dev' | 'build' | 'watch' | 'preview';
export type commandType = 'dev' | 'build' | 'watch' | 'preview';

export type UserConfigFnPromise = (env: ConfigEnv) => Promise<UserConfig>;
export type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
Expand Down Expand Up @@ -198,6 +198,7 @@ export interface ResolvedCompilation
export interface ResolvedUserConfig extends UserConfig {
root?: string;
mode?: string;
command?: commandType;
env?: Record<string, any>;
envDir?: string;
envFiles?: string[];
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class Server extends httpServer {
try {
this.config = await resolveConfig(
this.inlineConfig,
'start',
'dev',
'development',
'development'
);
Expand Down
Loading
Loading