File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
packages/solutions/app-tools/src/builder/generator Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change 33 type BundlerType ,
44 createBuilder ,
55} from '@modern-js/builder' ;
6- import { mergeRsbuildConfig } from '@rsbuild/core' ;
6+ import { type EnvironmentConfig , mergeRsbuildConfig } from '@rsbuild/core' ;
77import type { BuilderOptions } from '../shared' ;
88import { builderPluginAdapterCopy } from './adapterCopy' ;
99import { createBuilderProviderConfig } from './createBuilderProviderConfig' ;
@@ -32,9 +32,26 @@ export async function generateBuilder(
3232 tempBuilderConfig ,
3333 ) ;
3434
35- builderConfig . environments = builderConfig . environments
36- ? mergeRsbuildConfig ( environments , builderConfig . environments )
37- : environments ;
35+ if ( builderConfig . environments ) {
36+ const mergedEnvironments : Record < string , EnvironmentConfig > = {
37+ ...environments ,
38+ } ;
39+
40+ for ( const name in builderConfig . environments ) {
41+ if ( environments [ name ] ) {
42+ mergedEnvironments [ name ] = mergeRsbuildConfig (
43+ environments [ name ] ,
44+ builderConfig . environments [ name ] ,
45+ ) ;
46+ } else {
47+ mergedEnvironments [ name ] = builderConfig . environments [ name ] ;
48+ }
49+ }
50+
51+ builderConfig . environments = mergedEnvironments ;
52+ } else {
53+ builderConfig . environments = environments ;
54+ }
3855
3956 const builder = await createBuilder ( {
4057 cwd : appContext . appDirectory ,
You can’t perform that action at this time.
0 commit comments