Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

splitchunks in webpack 4

See original GitHub issue


In the cesium and webpack tutorial (, there is a section about code splitting which uses webpack.optimize.CommonsChunkPlugin. However, in the new webpack 4 this has been deprecated, so you get this error: ERROR Error: webpack.optimize.CommonsChunkPlugin has been removed, please use config.optimization.splitChunks instead.

I can’t seem to work out the correct syntax for using splitChunks with cesium, it would be very helpful to add this to the tutorial.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

bmckilligancommented, Jul 20, 2018

i was able to get things to work with this

optimization: {
    splitChunks: {
        cacheGroups: {
            commons: {
                test: /[\\/]node_modules[\\/]cesium/,
                name: 'Cesium',
                chunks: 'all'

Note I have the following also in webpack output: { path: path.resolve(__dirname, “Bundle”), filename: “[name].bundle.js”,

    // Needed to compile multiline strings in Cesium
    sourcePrefix: ''

and it created the file Cesium.bundle.js

Southjorcommented, Sep 7, 2018

ol-cesium-webpack-example 下载下来,直接运行 npm i 会报错, 由于我的环境是webpack4.,所以将package文件中的配置修改为webpack4., 运行npm i 正常; npm start 启动也失败,找不到js文件,于是修改webpack.config.js配置,增加了goog路径,运行成功.

Read more comments on GitHub >

github_iconTop Results From Across the Web

splitChunks.chunks. string = 'async' function (chunk). This indicates which chunks will be selected for optimization. When a string is provided, ...
Read more >
Webpack 4 — Mysterious SplitChunks Plugin
Webpack 4 — Mysterious SplitChunks Plugin ... The official release of Webpack-4 boasts about the proven faster build time (around 98%) and reduced ......
Read more >
Demystifying Webpack 4 Split Chunks Plugin
Recently, we migrated one of our web apps to the Webpack 4, which decreases build time and reduces chunk size by using Split...
Read more >
Webpack 4 and splitChunks - move all vendor code to a ...
I'm trying to configure the splitChunks plugin so it would output: app chunk including src code without dependencies and packages;; module1 ...
Read more >
Webpack: An in-depth introduction to SplitChunksPlugin
optimization: { // Instruct webpack not to obfuscate the resulting code minimize: false, splitChunks: { minSize: 0, chunks: 'all', minChunks: 4, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found