Javascript Webpack正在压缩我的整个项目,而不是捆绑js
每当我运行webpack时,它都会在项目的根目录中创建一个.tgz文件,而不是创建一个可以包含在html中的bundle.js文件 这是我的网页配置:Javascript Webpack正在压缩我的整个项目,而不是捆绑js,javascript,node.js,webpack-2,Javascript,Node.js,Webpack 2,每当我运行webpack时,它都会在项目的根目录中创建一个.tgz文件,而不是创建一个可以包含在html中的bundle.js文件 这是我的网页配置: const path = require('path') module.exports = { context: __dirname, entry: './client/index.js', output: { path: path.resolve('dist'), filename: 'index_bundle.js' },
const path = require('path')
module.exports = {
context: __dirname,
entry: './client/index.js',
output: {
path: path.resolve('dist'),
filename: 'index_bundle.js'
},
module: {
loaders: [
{ test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: /\.jsx$/, loader: 'babel-loader', exclude: /node_modules/ }
]
}
}
我的项目结构是这样的
babel.rc
dist
node_modules
webpack.config.js
client
- index.html
- index.js
jslib-1.0.0.tgz < --- this is the unwanted ouput.
package.json
非常感谢您的帮助或建议 您可能正在运行
npm-pack
,而不是npm-run[-script]pack
。通常,脚本是通过npm-run
运行的;有一些特殊的脚本,比如test
,它们具有相应的npm
命令,但是npmpack
是完全独立的
...
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"pack" : "webpack"
}