Skip to content

Commit 88467b3

Browse files
clydinfilipesilva
authored andcommitted
fix(@angular-devkit/build-angular): disable Webpack 5 automatic public path support
The Webpack 5 automatic public path support can cause an incorrect public path to be used to load assets and lazy loaded routes. The current logic relies on the last script element found at runtime in the application's index HTML which may not be related to the application scripts. Now if a `deployUrl` is not specified, the Webpack `publicPath` option is defaulted to an empty string which provides equivalent behavior to Webpack 4. (cherry picked from commit e107055)
1 parent bac34e5 commit 88467b3

File tree

1 file changed

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

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
432432
entry: entryPoints,
433433
output: {
434434
path: path.resolve(root, buildOptions.outputPath),
435-
publicPath: buildOptions.deployUrl,
435+
publicPath: buildOptions.deployUrl ?? '',
436436
filename: ({ chunk }) => {
437437
if (chunk?.name === 'polyfills-es5') {
438438
return `polyfills-es5${hashFormat.chunk}.js`;

0 commit comments

Comments
 (0)