diff --git a/packages/webpack/src/plugins/nx-webpack-plugin/lib/compiler-loaders.ts b/packages/webpack/src/plugins/nx-webpack-plugin/lib/compiler-loaders.ts index de2b3267cb504..e17085663e095 100644 --- a/packages/webpack/src/plugins/nx-webpack-plugin/lib/compiler-loaders.ts +++ b/packages/webpack/src/plugins/nx-webpack-plugin/lib/compiler-loaders.ts @@ -54,7 +54,9 @@ export function createLoaderFromCompiler( }, }; case 'babel': - const tsConfig = readTsConfig(path.join(options.root, options.tsConfig)); + const tsConfig = options.tsConfig + ? readTsConfig(path.join(options.root, options.tsConfig)) + : undefined; const babelConfig = { test: /\.([jt])sx?$/, @@ -62,7 +64,9 @@ export function createLoaderFromCompiler( exclude: /node_modules/, options: { cwd: path.join(options.root, options.sourceRoot), - emitDecoratorMetadata: tsConfig.options.emitDecoratorMetadata, + emitDecoratorMetadata: tsConfig + ? tsConfig.options.emitDecoratorMetadata + : false, isModern: true, isTest: process.env.NX_CYPRESS_COMPONENT_TEST === 'true', envName: process.env.BABEL_ENV ?? process.env.NODE_ENV,