我创建了简单的react应用和webpack进行捆绑,这是
webpack.config.js
module.exports = {
entr:{
app:'./src/index.js'
},
output: {
path: path.join('./dist'),
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
}
};
package.json
{
"name": "webpack-js",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"babel": "^6.23.0",
"babel-core": "^6.26.3",
"babel-generator": "^6.26.1",
"babel-helper-replace-supers": "^6.24.1",
"babel-helpers": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-register": "^6.26.0",
"bable-loader": "^0.0.1-security",
"convert-source-map": "^1.6.0",
"json5": "^0.5.1",
"react": "^0.14.9",
"react-dom": "^0.14.9",
"regenerator-transform": "^0.10.1",
"slash": "^1.0.0",
"trim-right": "^1.0.1"
},
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.6",
"prop-types": "^15.7.2",
"webpack": "^1.15.0",
"webpack-cli": "^3.3.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --mode production"
},
"keywords": [],
"author": "",
"license": "ISC"
}
运行npm run build
命令后,它会在cmd上提示以下消息,但没有bundle.js
文件。
E:\Dev\webpack-js>npm run build
> webpack-js@1.0.0 build E:\Dev\webpack-js
> webpack --mode production
Hash: 396f0bfb9d565b6f60f0
Version: webpack 1.15.0
Time: 46ms
为什么不创建bundle.js
文件?