2 Star 0 Fork 0

lichao / lemon-public

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webpack.config.js 1.66 KB
一键复制 编辑 原始数据 按行查看 历史
Weilin Shi 提交于 2016-06-24 16:23 . 增加 国际化
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';
}
JavaScript
1
https://gitee.com/increase/lemon-public.git
git@gitee.com:increase/lemon-public.git
increase
lemon-public
lemon-public
master

搜索帮助