Skip to content

Commit 293526c

Browse files
committedMar 30, 2022
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 (cherry picked from commit 371da23)
1 parent cf3cb2e commit 293526c

File tree

1 file changed

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

1 file changed

+4
-2
lines changed
 

‎packages/angular_devkit/build_angular/src/webpack/configs/common.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,9 @@ export async function getCommonConfig(wco: WebpackConfigOptions): Promise<Config
261261
test: tsConfig.options.allowJs ? /\.[cm]?[tj]sx?$/ : /\.[cm]?tsx?$/,
262262
loader: AngularWebpackLoaderPath,
263263
// The below are known paths that are not part of the TypeScript compilation even when allowJs is enabled.
264-
exclude: [/[/\\](?:css-loader|mini-css-extract-plugin|webpack-dev-server|webpack)[/\\]/],
264+
exclude: [
265+
/[\\/]node_modules[/\\](?:css-loader|mini-css-extract-plugin|webpack-dev-server|webpack)[/\\]/,
266+
],
265267
});
266268
extraPlugins.push(createIvyPlugin(wco, aot, tsConfigPath));
267269
}
@@ -384,7 +386,7 @@ export async function getCommonConfig(wco: WebpackConfigOptions): Promise<Config
384386
// The below is needed due to a bug in `@babel/runtime`. See: https://github.com/babel/babel/issues/12824
385387
resolve: { fullySpecified: false },
386388
exclude: [
387-
/[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill|whatwg-url)[/\\]/,
389+
/[\\/]node_modules[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill|whatwg-url)[/\\]/,
388390
],
389391
use: [
390392
{

0 commit comments

Comments
 (0)