...
|
...
|
@@ -2,19 +2,18 @@ const webpack = require('webpack'); |
|
|
const path = require('path');
|
|
|
const merge = require('webpack-merge');
|
|
|
const VueSSRClientPlugin = require('vue-server-renderer/client-plugin');
|
|
|
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
|
|
const pkg = require('../package.json');
|
|
|
const shelljs = require('shelljs');
|
|
|
// const shelljs = require('shelljs');
|
|
|
|
|
|
let baseConfig = require('./webpack.base.conf');
|
|
|
const postcssConfig = require('./postcss.config.js');
|
|
|
|
|
|
const isProd = process.env.NODE_ENV === 'production';
|
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
shelljs.exec(`cp -R ${path.join(__dirname, '../public/font/')} ${path.join(__dirname, '../src/statics/font/')}`, {async: true});
|
|
|
shelljs.exec(`cp -R ${path.join(__dirname, '../public/img/')} ${path.join(__dirname, '../src/statics/img/')}`, {async: true});
|
|
|
}
|
|
|
// if (process.env.NODE_ENV === 'production') {
|
|
|
// shelljs.exec(`cp -R ${path.join(__dirname, '../public/font/')} ${path.join(__dirname, '../src/statics/font/')}`, {async: true});
|
|
|
// shelljs.exec(`cp -R ${path.join(__dirname, '../public/img/')} ${path.join(__dirname, '../src/statics/img/')}`, {async: true});
|
|
|
// }
|
|
|
|
|
|
const webpackConfig = merge(baseConfig, {
|
|
|
entry: {
|
...
|
...
|
@@ -66,11 +65,22 @@ const webpackConfig = merge(baseConfig, { |
|
|
});
|
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
webpackConfig.plugins.push(new UglifyJSPlugin({
|
|
|
webpackConfig.plugins.push(new webpack.optimize.UglifyJsPlugin({
|
|
|
parallel: true,
|
|
|
sourceMap: true
|
|
|
sourceMap: true,
|
|
|
uglifyOptions: {
|
|
|
compress: {
|
|
|
warnings: false
|
|
|
},
|
|
|
comments: false
|
|
|
}
|
|
|
}));
|
|
|
webpackConfig.output.publicPath = '//cdn.yoho.cn/yohoblk-wap/bundle/';
|
|
|
|
|
|
}
|
|
|
|
|
|
let BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
|
|
|
|
webpackConfig.plugins.push(new BundleAnalyzerPlugin());
|
|
|
|
|
|
module.exports = webpackConfig; |
...
|
...
|
|