Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing script tags in index file with CompressionWebpackPlugin and property 'deleteOriginalAssets' #1266

Open
KristinaB162 opened this issue Aug 30, 2022 · 0 comments

Comments

@KristinaB162
Copy link

Describe the Bug

After updating Angular from version 11 to 14, the build no longer works correctly. The scripts tag (for runtime, polyfills and main) in the index.html are missing.

I use the "@angular-builders/custom-webpack" with the Webpack CompressionPlugin. To not have the compressed and uncompressed files in the dist directory, the 'deleteOriginalAssets' property is set to true. If 'deleteOriginalAssets' is set to false, the build is working fine.

Minimal Reproduction

  1. Set up a new project with angular cli (no routing, css)
    ng new repro-app
  2. Add in package.json in "devDependencies":
"@angular-builders/custom-webpack":"^14.0.1",
"compression-webpack-plugin":"^10.0.0",
  1. Add a new file in root directory called 'extra-webpack.config.js'
  2. Write this code into 'extra-webpack.config.js':
const CompressionPlugin = require("compression-webpack-plugin");

module.exports = {
    plugins: [
        new CompressionPlugin({
            deleteOriginalAssets: true,
        })
    ],
};
  1. In angular.json change the builder in build to @angular-builders/custom-webpack:browser
  2. Add the option in build:
"customWebpackConfig": {
              "path": "./extra-webpack.config.js"
            },
  1. Run npm i
  2. Run npm run build
  3. In the dist directory you will see the zipped files and the index.html with missing scripts tag. (Running npm run build with deleteOriginalAssets set to false, the index.html is fine).

Expected Behavior

Index.html with script tags for main, polyfills and runtime

Something like this is missing:


<script src="runtime.dd33940cddb71537.js" type="module"></script>
<script src="polyfills.240ce46083334aa2.js" type="module"></script>
<script src="main.bed6caf36cdc29a3.js" type="module"></script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant