Skip to content

Commit 371da23

Browse files
committed
fix(@angular-devkit/build-angular): add node_modules prefix to excludes RegExp
Without the `node_modules` prefix, projects named the same as the excluded package names ex: `webpack` will not compile successfully as all files under the mentioned project will be excluded from being requested by the respective loaders. Closes #22902
1 parent 1bbabb2 commit 371da23

File tree

1 file changed

+4
-2
lines changed
  • packages/angular_devkit/build_angular/src/webpack/configs

1 file changed

+4
-2
lines changed

Diff for: packages/angular_devkit/build_angular/src/webpack/configs/common.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ export async function getCommonConfig(wco: WebpackConfigOptions): Promise<Config
243243
test: tsConfig.options.allowJs ? /\.[cm]?[tj]sx?$/ : /\.[cm]?tsx?$/,
244244
loader: AngularWebpackLoaderPath,
245245
// The below are known paths that are not part of the TypeScript compilation even when allowJs is enabled.
246-
exclude: [/[/\\](?:css-loader|mini-css-extract-plugin|webpack-dev-server|webpack)[/\\]/],
246+
exclude: [
247+
/[\\/]node_modules[/\\](?:css-loader|mini-css-extract-plugin|webpack-dev-server|webpack)[/\\]/,
248+
],
247249
});
248250
extraPlugins.push(createIvyPlugin(wco, aot, tsConfigPath));
249251
}
@@ -366,7 +368,7 @@ export async function getCommonConfig(wco: WebpackConfigOptions): Promise<Config
366368
// The below is needed due to a bug in `@babel/runtime`. See: https://github.com/babel/babel/issues/12824
367369
resolve: { fullySpecified: false },
368370
exclude: [
369-
/[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill|whatwg-url)[/\\]/,
371+
/[\\/]node_modules[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill|whatwg-url)[/\\]/,
370372
],
371373
use: [
372374
{

0 commit comments

Comments
 (0)