Skip to content

Commit 2f2069d

Browse files
alan-agius4filipesilva
authored andcommitted
fix(@angular-devkit/build-angular): disable parsing new URL syntax
When web-workers are enabled we allowing parsing `new URL` syntax which has the side-effect that Webpack will treat all assets as asset modules (https://webpack.js.org/guides/asset-modules/#url-assets). With this change we remove this inconsistency by disabling the `url` parsing which doesn't effect `new Worker(new URL(...))`. (cherry picked from commit a0784bd)
1 parent 05d762c commit 2f2069d

File tree

1 file changed

+8
-10
lines changed
  • packages/angular_devkit/build_angular/src/webpack/configs

1 file changed

+8
-10
lines changed

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -357,16 +357,14 @@ export async function getCommonConfig(wco: WebpackConfigOptions): Promise<Config
357357
module: {
358358
// Show an error for missing exports instead of a warning.
359359
strictExportPresence: true,
360-
parser:
361-
webWorkerTsConfig === undefined
362-
? {
363-
javascript: {
364-
worker: false,
365-
url: false,
366-
},
367-
}
368-
: undefined,
369-
360+
parser: {
361+
javascript: {
362+
// Disable auto URL asset module creation. This doesn't effect `new Worker(new URL(...))`
363+
// https://webpack.js.org/guides/asset-modules/#url-assets
364+
url: false,
365+
worker: !!webWorkerTsConfig,
366+
},
367+
},
370368
rules: [
371369
{
372370
test: /\.?(svg|html)$/,

0 commit comments

Comments
 (0)