javascript - "CommonsChunkPlugin now only takes a single argument.。。。。
巴扎黑
巴扎黑 2017-05-16 13:43:17
0
4
651

Error: Deprecation notice: CommonsChunkPlugin now only takes a single argument. Either an options
object *or* the name of the chunk.
Example: if your old code looked like this:
        new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js')
You would change it to:
        new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.bundle.js' })
The available options are:
        name: string
        names: string[]
        filename: string
        minChunks: number
        chunks: string[]
        children: boolean
        async: boolean
        minSize: number
    at new CommonsChunkPlugin (E:\heShengWeb\manta-web\node_modules\webpack\lib\optimize\CommonsChunkPlugin.js:10:10)
    at Object.<anonymous> (E:\heShengWeb\manta-web\webpack\base.config.js:82:9)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (E:\heShengWeb\manta-web\webpack\webpack.build.config.js:5:18)

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "E:\Software\Nodejs\node.exe" "E:\Software\Nodejs\node_global\node_modules\npm\bin\npm-cli.js" "run" "build"
npm ERR! node v6.3.0
npm ERR! npm  v3.8.0
npm ERR! code ELIFECYCLE
npm ERR! mantaweb@1.0.0 build: `webpack --config webpack/webpack.build.config.js --progress --colors`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mantaweb@1.0.0 build script 'webpack --config webpack/webpack.build.config.js --progress --colors'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the mantaweb package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack --config webpack/webpack.build.config.js --progress --colors
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs mantaweb
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls mantaweb
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     E:\heShengWeb\manta-web\npm-debug.log

It is true that my CommonsChunkPlugin configuration looks like the error reported by him, but it is not wrong when I configure it like this on the company's computer. Why does it report this error when I return to my computer at home? How can I solve it (I don't know) Want to change this configuration too much)?

巴扎黑
巴扎黑

reply all(4)
过去多啦不再A梦

Don’t use webpack2.x. The configuration used by the company should be webpack1.x. The configuration of 2.x is different from 1.x. Please check the webpack version of your computer to see if it is 2.x

淡淡烟草味

CommonsChunkPlugin
The version has been updated and no longer supports the original parameter passing method
And it should have been a long time ago...

And the error message gives the correct method:

new webpack.optimize.CommonsChunkPlugin({ 
    name: 'vendor', 
    filename: 'vendor.bundle.js', 
    minChunks: Infinity 
})
左手右手慢动作

Just change the library to another version. Whatever version your company uses, just use the version here.

小葫芦

Either update webpack to 2.x or go back to webpack 1.x. Because your company uses an old version, it is said to maintain consistency. It is recommended that you change to 1.x, which will also facilitate the consistency of your code.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!