fix(rspack): handle configs with default exports (#29825)
## Current Behavior When we resolve the config file for rspack, it can be provided in a few different formats: ``` config config.default config.default.default ``` We do not handle if the config is provided in any of the named default methods. ## Expected Behavior Handle named defaults for the resolved user config for Rspack.
This commit is contained in:
parent
6b9496d8ef
commit
00b9525bef
@ -3,7 +3,7 @@
|
|||||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
"sourceRoot": "e2e/react",
|
"sourceRoot": "e2e/react",
|
||||||
"projectType": "application",
|
"projectType": "application",
|
||||||
"implicitDependencies": ["react"],
|
"implicitDependencies": ["react", "rspack"],
|
||||||
"// targets": "to see all targets run: nx show project e2e-react --web",
|
"// targets": "to see all targets run: nx show project e2e-react --web",
|
||||||
"targets": {}
|
"targets": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,10 +13,16 @@ export async function getRspackConfigs(
|
|||||||
options: NormalizedRspackExecutorSchema & { devServer?: any },
|
options: NormalizedRspackExecutorSchema & { devServer?: any },
|
||||||
context: ExecutorContext
|
context: ExecutorContext
|
||||||
): Promise<Configuration | Configuration[]> {
|
): Promise<Configuration | Configuration[]> {
|
||||||
let userDefinedConfig = await resolveUserDefinedRspackConfig(
|
let maybeUserDefinedConfig = await resolveUserDefinedRspackConfig(
|
||||||
options.rspackConfig,
|
options.rspackConfig,
|
||||||
options.tsConfig
|
options.tsConfig
|
||||||
);
|
);
|
||||||
|
let userDefinedConfig =
|
||||||
|
'default' in maybeUserDefinedConfig
|
||||||
|
? 'default' in maybeUserDefinedConfig.default
|
||||||
|
? maybeUserDefinedConfig.default.default
|
||||||
|
: maybeUserDefinedConfig.default
|
||||||
|
: maybeUserDefinedConfig;
|
||||||
|
|
||||||
if (typeof userDefinedConfig.then === 'function') {
|
if (typeof userDefinedConfig.then === 'function') {
|
||||||
userDefinedConfig = await userDefinedConfig;
|
userDefinedConfig = await userDefinedConfig;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user