Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): disable Webpack 5 automatic publi…
Browse files Browse the repository at this point in the history
…c 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.
  • Loading branch information
clydin authored and filipesilva committed Apr 20, 2021
1 parent 7d56d48 commit e107055
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
entry: entryPoints,
output: {
path: path.resolve(root, buildOptions.outputPath),
publicPath: buildOptions.deployUrl,
publicPath: buildOptions.deployUrl ?? '',
filename: ({ chunk }) => {
if (chunk?.name === 'polyfills-es5') {
return `polyfills-es5${hashFormat.chunk}.js`;
Expand Down

0 comments on commit e107055

Please sign in to comment.