最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Webpack 5 ChunkGroup API with multiple entries? - Stack Overflow

programmeradmin8浏览0评论

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...
}

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...
}
Share Improve this question edited Dec 15, 2020 at 0:54 Eduardo Morales asked Dec 12, 2020 at 23:02 Eduardo MoralesEduardo Morales 82311 silver badges32 bronze badges 2
  • Could it be the problem of using .ts along with .scss in your entry points? Why don't you import scss in the ts file respectively? Any specific benefits? – Sam Chen Commented Dec 13, 2020 at 1:52
  • do you know what the ChunkGroup API is? – Eduardo Morales Commented Dec 14, 2020 at 19:14
Add a ment  | 

1 Answer 1

Reset to default 20

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

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

发布评论

评论列表(0)

  1. 暂无评论