Webpack npm run build packing error, did not find the reason, please let me know.

clipboard.png

webpack.optimize.CommonsChunkPlugin has been removed, please use config.optimization.splitChunks instead. webpack4.0CommonsChunkPlugin

CommonsChunkPluginSplitChunksPlugin

clipboard.png

:

clipboard.png

input / output configuration:
entry: path.join (_ _ dirname,".. / src/index.js"), / / input: project master file (entry file)

output: {       // 
    filename: "build.[hash:8].js",  // 
    path: path.join(__dirname, "./dist")  // 
}

generate the configuration of the environment:

webpack.config.client.js 

config = merge(baseConfig,{
    entry:{  // 
        app: path.join(__dirname, "../src/index.js"),
        vendor: ["vue"]
    },
    output:{
        filename: "[name].[chunkhash:8].js",
    },
    module:{
        rules:[
            {
                fallback: "style-loader",
                use: [
                    "css-loader",
                    {
                        loader: "postcss-loader",
                        options: {
                            sourceMap: true
                        }
                    },
                    "stylus-loader"
                ]
            }
        ]
    },
    plugins:defaultPluins.concat([
        new ExtractPlugin("styles.[contentHash:8].css"),
        // 
        new webpack.optimize.SplitChunksPlugin({
            name: "vendor"
        }),
      
        // webpack
        new webpack.optimize.SplitChunksPlugin({
            name: "runtime"
        })
        
    ]),
    optimization:{
        splitChunks: {
            cacheGroups: {                  //  chunks
                commons: {
                    chunks: "initial",      // : "initial" | "all" | "async"()
                    minSize: 0,             // 0,
                    minChunks: 2,           //  chunk 1
                    maxInitialRequests: 5   // 1
                },  
                vendor: {
                    test: /node_modules/,   //  chunk
                    chunks: "initial",      // : "initial" | "all" | "async"()
                    name: "vendor",         //   chunk 
                    priority: 10,           // 
                    enforce: true
                }
            }
        },
        runtimeChunk: true
    }
    
})
Mar.21,2021
The attribute fallback in

webpack is no longer supported after webpack is upgraded. It is recommended to take a look at webpack4 configuration webpack4 configuration

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3e0ae-e930.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3e0ae-e930.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?