Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): disable parsing new URL syntax
Browse files Browse the repository at this point in the history
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(...))`.
  • Loading branch information
alan-agius4 authored and filipesilva committed Jan 16, 2022
1 parent c9cb330 commit a0784bd
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,16 +357,14 @@ export async function getCommonConfig(wco: WebpackConfigOptions): Promise<Config
module: {
// Show an error for missing exports instead of a warning.
strictExportPresence: true,
parser:
webWorkerTsConfig === undefined
? {
javascript: {
worker: false,
url: false,
},
}
: undefined,

parser: {
javascript: {
// Disable auto URL asset module creation. This doesn't effect `new Worker(new URL(...))`
// https://webpack.js.org/guides/asset-modules/#url-assets
url: false,
worker: !!webWorkerTsConfig,
},
},
rules: [
{
test: /\.?(svg|html)$/,
Expand Down

0 comments on commit a0784bd

Please sign in to comment.