GoogleChromeLabs / critters

🦔 A Webpack plugin to inline your critical CSS and lazy-load the rest.

Home Page:https://npm.im/critters-webpack-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't work on production mode

afifkhaidir-tkpd opened this issue · comments

Need help, my Critters plugin doesn't work on production build, but works well on development mode. I am using webpack-dev-server for development.

Here's on my webpack.config.js:

if (userConfig.html.length !== 0) {
  webpackConfig.plugins = webpackConfig.plugins
    .concat(userConfig.html.map(htmlConfig => new HtmlWebpackPlugin(htmlConfig)))
    .concat([new ScriptExtHtmlWebpackPlugin({ defaultAttribute: 'async' })])
    .concat([new CrittersPlugin({})]);
}

This is userConfig I used for HTML Webpack Plugin:

const config = {
  ...
  html: [
    {
      template: './src/intro.html',
      filename: 'intro/index.html',
      chunks: ['intro/intro'],
    },
  ],
  ...
};

module.exports = config;

And this is my node script to run production build:
NODE_ENV=production webpack -r dotenv/config

What doesn't work about it? Is there an error?

Likely the .split() error fixed in 2.2.0.

@afifkhaidir-tkpd please re-open if the issue persists after updating to 2.2.0+.