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

add check for chunks before checking length #224

Closed
wants to merge 6 commits into from

Conversation

ratherblue
Copy link

@ratherblue ratherblue commented Nov 1, 2020

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:

Description

I have a really basic webpack file with the following:

const path = require('path')
const ManifestPlugin = require('webpack-manifest-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')

const config = {
  entry: {
    app: './src/app.js'
  },
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'build')
  },
  module: {
    rules: [
      {
        test: /\.(less)$/,
        use: [
          'style-loader',
          MiniCssExtractPlugin.loader,
          'css-loader',
          'postcss-loader',
          'less-loader'
        ]
      }
    ]
  },
  plugins: [
    new MiniCssExtractPlugin({
      filename: './styles.[contenthash].css'
    }),
    new ManifestPlugin()
  ]
}

module.exports = config

I get the following error when building:

[webpack-cli] TypeError: Cannot read property 'length' of undefined
    at /home/travis/build/ratherblue/boilerplate/node_modules/webpack-manifest-plugin/lib/plugin.js:129:39
    at Array.reduce (<anonymous>)
    at ManifestPlugin.<anonymous> (/home/travis/build/ratherblue/boilerplate/node_modules/webpack-manifest-plugin/lib/plugin.js:116:26)
    at Hook.eval [as callAsync] (eval at create (/home/travis/build/ratherblue/boilerplate/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/travis/build/ratherblue/boilerplate/node_modules/tapable/lib/Hook.js:18:14)
    at Compiler.emitAssets (/home/travis/build/ratherblue/boilerplate/node_modules/webpack/lib/Compiler.js:739:19)
    at /home/travis/build/ratherblue/boilerplate/node_modules/webpack/lib/Compiler.js:398:10
    at processTicksAndRejections (node:internal/process/task_queues:75:11)
npm ERR! code 1
npm ERR! path /home/travis/build/ratherblue/boilerplate
npm ERR! command failed
npm ERR! command sh -c webpack

Here are my dependencies:

  "dependencies": {
    "autoprefixer": "^10.0.1",
    "css-loader": "^5.0.0",
    "less": "^3.12.2",
    "less-loader": "^7.0.2",
    "mini-css-extract-plugin": "^1.2.1",
    "postcss": "^8.1.4",
    "postcss-less": "^4.0.0",
    "postcss-loader": "^4.0.4",
    "style-loader": "^2.0.0",
    "stylelint": "^13.7.2",
    "stylelint-config-standard": "^20.0.0",
    "webpack": "^5.2.0",
    "webpack-cli": "^4.1.0",
    "webpack-manifest-plugin": "^2.2.0"
  }

@ratherblue
Copy link
Author

ratherblue commented Nov 1, 2020

This is a webpack 5 compatibility fix. chunks appear to no longer be automatically generated

@ratherblue
Copy link
Author

Going to close this since it's a webpack 5 issue

Copy link

@ellenmartin22 ellenmartin22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😀

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

Successfully merging this pull request may close these issues.

None yet

2 participants