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

adding deleteOriginalAssets flag causing build failure #41

Open
issambaccouch opened this issue Oct 23, 2020 · 1 comment
Open

adding deleteOriginalAssets flag causing build failure #41

issambaccouch opened this issue Oct 23, 2020 · 1 comment

Comments

@issambaccouch
Copy link

angular 8.0.0
"@angular-builders/custom-webpack": "8.4.1",
"brotli-webpack-plugin": "^1.1.0",
"compression-webpack-plugin": "^6.0.3",

98% after emitting BundleBudgetPluginCannot read property 'size' of undefined
TypeError: Cannot read property 'size' of undefined
at.../node_modules/@angular-devkit/build-angular/src/angular-cli-files/utilities/bundle-calculator.js:48:58

custom-webpack.config.js :
const CompressionPlugin = require(compression-webpack-plugin); const BrotliPlugin = require(brotli-webpack-plugin); const path = require(path); module.exports = { plugins:[ new BrotliPlugin({ asset: '[fileWithoutExt].[ext].br', test: /\.(js|css|html|svg|txt|eot|otf|ttf|gif)$/, deleteOriginalAssets: true , }), new CompressionPlugin({ test: /\.(js|css|html|svg|txt|eot|otf|ttf|gif)$/, filename(info){ let opFile= info.path.split('.'), opFileType = opFile.pop(), opFileName = opFile.join('.'); return ${opFileName}.${opFileType}.gzip; } }) ], }

@lanxuexing
Copy link

Not that I know of, but I'm slightly relieved I'm not the only one experiencing this.

const CompressionPlugin = require("compression-webpack-plugin");
const zlib = require("zlib");

module.exports = {
  plugins: [
    new CompressionPlugin({
      filename: "[path][base].br",
      algorithm: "brotliCompress",
      test: /\.(js|css|html|svg)$/,
      compressionOptions: {
        params: {
          [zlib.constants.BROTLI_PARAM_QUALITY]: 11,
        },
      },
      threshold: 10240,
      minRatio: 0.8,
      deleteOriginalAssets: true,
    }),
  ],
};

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

2 participants