Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 网页包供应商区块自动创建_Angularjs_Webpack - Fatal编程技术网

Angularjs 网页包供应商区块自动创建

Angularjs 网页包供应商区块自动创建,angularjs,webpack,Angularjs,Webpack,我想创建两个网页块:app.js和vendor.js 目前我有smth,如: entry = { psw: DIR.src, vendor: ["angular", "angular-ui-router", "angular-bootstrap"] }; ... plugins.push(new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js')) (如这里) 这工作很好(至

我想创建两个网页块:app.js和vendor.js 目前我有smth,如:

entry = {
        psw: DIR.src,
        vendor: ["angular", "angular-ui-router", "angular-bootstrap"]
    };
...
plugins.push(new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js'))
(如这里)


这工作很好(至少它工作正常,看起来还不错)。但是,我希望自动生成“供应商”数组。你知道怎么做吗?

使用SplitByPath插件得到了它。它将js和css分开,所以使用起来非常好。不知道为什么它被引用得如此罕见

config.plugins.push(new SplitByPathPlugin([{ name : 'vendor', path: [path.join(__dirname, 'node_modules'), path.join(__dirname, 'bower_components')]}]));

使用SplitByPath插件获得它。它将js和css分开,所以使用起来非常好。不知道为什么它被引用得如此罕见

config.plugins.push(new SplitByPathPlugin([{ name : 'vendor', path: [path.join(__dirname, 'node_modules'), path.join(__dirname, 'bower_components')]}]));