1
我試圖儘量減少我bundle.js用的WebPack文件,但得到的我的配置錯誤:如何使用Webpack最小化JavaScript?
module.exports = {
entry: "./entry.js",
output: {
devtoolLineToLine: true,
sourceMapFilename: "./bundle.js.map",
pathinfo: true,
path: __dirname,
filename: "bundle.js"
},
module: {
loaders: [
{ test: /\.css$/, loader: "style!css" }
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true
})
]
};
錯誤:像你在頂部缺少var webpack = require('webpack');
/Users/leongaban/Projects/TickerTags/ionic/TickerTags/www/webpack.config.js:16
new webpack.optimize.UglifyJsPlugin({
^
ReferenceError: webpack is not defined
謝謝,就是這樣!現在可以發佈另一個問題,我只是運行這個配置,並沒有注意到任何最小化的文件...缺少一些我看到的步驟 –