代码拉取完成,页面将自动刷新
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var htmlPluginConfig = new HtmlWebpackPlugin({
template: 'index.html',
filename: 'index.html',
inject: 'body'
});
var cssnext = require('postcss-cssnext');
module.exports = {
entry: './module/main.js',
output: {
path: path.resolve(__dirname, './output'),
filename: 'build.js'
},
module: {
// avoid webpack trying to shim process
noParse: /es6-promise\.js$/,
loaders: [
{
test: /\.vue$/,
loader: 'vue'
}, {
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel'
}, {
// transform own css
test: /\.css$/,
exclude: /node_modules/,
loader: 'style!css!postcss'
}, {
// do not transform vendor css
test: /\.css$/,
include: /node_modules/,
loader: 'style!css'
}, {
test: /\.(png|svg|jpg)$/,
exclude: /node_modules/,
loader: 'url-loader?limit=10000&name=res/[hash].[ext]',
}, {
test: /\.json$/,
exclude: /node_modules/,
loader: 'json',
}
]
},
babel: {
presets: ['es2015', 'stage-3'],
plugins: ['transform-runtime']
},
postcss: function () {
return [cssnext({
browsers: ['last 2 versions', 'IE > 10']
})]
},
plugins: [
htmlPluginConfig
]
};
if (process.env.NODE_ENV === 'production') {
module.exports.plugins = [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
htmlPluginConfig
];
} else {
module.exports.devtool = '#source-map';
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。