Eduardo Morales
Eduardo Morales

Reputation: 823

Webpack 5 ChunkGroup API with multiple entries?

When trying to upgrade to Webpack 5 from Webpack 4, I get the following error message:

Module.entryModule: Multiple entry modules are not supported by the deprecated API (Use the new ChunkGroup API)

I have tried to find documentation on ChunkGroup API but I can't seem to find anything. Do you know what the new way of having multiple entries is or how to use ChunkGroup API?

My module.exports looks as follows:

const config = {
  entry: {
    dev1: [
      __dirname + "/js/tools/dev1/dev1.ts",
      __dirname + "/css/tools/dev1.scss",
    ],
    dev2: [__dirname + "/js/dev2.ts", __dirname + "/css/dev2.scss"],
    ],
  },
  output: {
    path: path.resolve(__dirname, "../") + "/server/dist",
    filename: "[name].js",
  },
  resolve: {
    extensions: [".js", ".ts", ".tsx"],
  },
  // OMITTED FOR SIMPLICITY...
}

Upvotes: 6

Views: 3458

Answers (1)

Eduardo Morales
Eduardo Morales

Reputation: 823

My issue was that I was using "webpack-fix-style-only-entries" but it is not compatible with Webpack 5. Instead, I switched to webpack-remove-empty-scripts.

See: https://libraries.io/npm/webpack-remove-empty-scripts

Upvotes: 20

Related Questions