使用webpack2时一切正常,直到我尝试使用CommonsChunkPlugin。这是我的webpack.config
var path = require("path");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var LiveReloadPlugin = require("webpack-livereload-plugin");
var CopyWebpackPlugin = require("copy-webpack-plugin");
var pkg = require("./package.json");
var webpack = require("webpack");
//new UglifyJsPlugin({ sourceMap: false })
var baseConfig = {
entry: {
bundle: "./src/index",
vendor: Object.keys(pkg.dependencies),
load: "./src/load"
},
resolve: {
alias: {
"@rzr-ui": path.join(__dirname, "src/rzr-ui/src/js/ui/")
},
extensions: [".js", ".jsx"]
},
output: {
path: path.join(__dirname, "dist"),
filename: "[name].js"
},
devServer: {
headers: { "Access-Control-Allow-Origin": "*" }
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: "vendor",
minChunks: function (module) {
// this assumes your vendor imports exist in the node_modules directory
return module.context && module.context.indexOf("node_modules") !== -1;
}
})
],
module: {
rules: [
......
我收到了这些错误。无法理解背后的原因是什么
WARNING in ./~/npm-check/lib/in/read-package-json.js
9:14-31 Critical dependency: the request of a dependency is an expression
WARNING in ./~/depcheck/dist/constants.js
24:18-72 Critical dependency: the request of a dependency is an expression
WARNING in ./~/depcheck/dist/utils/index.js
27:9-26 Critical dependency: the request of a dependency is an expression
WARNING in ./~/depcheck/dist/utils/index.js
44:11-26 Critical dependency: the request of a dependency is an expression
ERROR in multi (webpack)-dev-server/client?http://localhost:8000 @hotelsoft/common @hotelso... ... ...
Module not found: Error: Can't resolve '@hotelsoft/common' in '/Users/vishal/Documents/visdWorkspace/spydr-ui'
@ multi (webpack)-dev-server/client?http://localhost:8000 @hotelsoft/common @hotelsoft/icons @ho... ... ... .....
ERROR in multi (webpack)-dev-server/client?http://localhost:8000 @hotelsoft/common @hotelso... ... ...
Module not found: Error: Can't resolve 'font-awesome' in '/Users/vishal/Documents/visdWorkspace/spydr-ui'
@ multi (webpack)-dev-server/client?http://localhost:8000 @hotelsoft/common @hotelsoft/icons @ho... ... ... .....
ERROR in ./~/react-tab/lib/index.js
Module parse failed: /Users/vishal/Documents/visdWorkspace/spydr-ui/node_modules/react-tab/lib/index.js Unexpected token (7:12)
You may need an appropriate loader to handle this file type.
| render: function () {
| return (
| <div>Tab</div>
| );
| }
@ multi (webpack)-dev-server/client?http://localhost:8000 @hotelso.... ... ...
ERROR in ./~/path-exists/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/vishal/Documents/visdWorkspace/spydr-ui/node_modules/path-exists'
@ ./~/path-exists/index.js 2:9-22
@ ./~/npm-check/lib/in/create-package-summary.js
@ ./~/npm-check/lib/in/index.js
@ ./~/npm-check/lib/index.js
@ multi (webpack)-dev-server/client?http://localhost:8000 @hotelsoft/comm .... .... .....
ERROR in ./~/depcheck/dist/check.js
Module not found: Error: Can't resolve 'fs' in '/Users/vishal/Documents/visdWorkspace/spydr-ui/node_modules/depcheck/dist'
@ ./~/depcheck/dist/check.js 13:10-23
@ ./~/depcheck/dist/index.js
@ ./~/npm-check/lib/in/get-unused-packages.js
@ ./~/npm-check/lib/in/index.js
@ ./~/npm-check/lib/index.js
@ multi (webpack)-dev-server/client?http://localhost:8000 @hotelsoft/com
希望有人在这里帮助我