2018-03-21 17:44:27 +00:00
|
|
|
var path = require('path');
|
|
|
|
var webpack = require('webpack');
|
|
|
|
var UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
|
|
|
|
|
|
|
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
|
|
|
|
|
|
|
const extractSass = new ExtractTextPlugin({
|
|
|
|
filename: "[name].css",
|
|
|
|
disable: process.env.NODE_ENV === "development"
|
|
|
|
});
|
|
|
|
|
|
|
|
var mod_common = {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
'vue-style-loader',
|
|
|
|
'css-loader'
|
|
|
|
],
|
|
|
|
}, {
|
|
|
|
test: /\.vue$/,
|
|
|
|
loader: 'vue-loader',
|
|
|
|
options: {
|
|
|
|
loaders: {} // other vue-loader options go here
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel-loader',
|
|
|
|
exclude: /node_modules/
|
|
|
|
}, {
|
|
|
|
test: /\.(png|jpg|gif)$/,
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: { name: '[name].[ext]?[hash]' }
|
|
|
|
}, {
|
|
|
|
test: /\.svg$/,
|
|
|
|
loader: 'vue-svg-loader', // `vue-svg` for webpack 1.x
|
|
|
|
options: {
|
|
|
|
// optional [svgo](https://github.com/svg/svgo) options
|
|
|
|
svgo: {
|
|
|
|
plugins: [
|
|
|
|
{removeDoctype: true},
|
|
|
|
{removeComments: true}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
|
|
|
name: "main",
|
|
|
|
entry: './webpack/main.js',
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, './public_html/js'),
|
|
|
|
publicPath: '/js/',
|
|
|
|
filename: 'bundle.js'
|
|
|
|
},
|
|
|
|
module: mod_common,
|
2018-03-22 12:40:48 +00:00
|
|
|
devtool: (process.env.NODE_ENV!=='production') ? '#eval-source-map' : false
|
2018-03-21 17:44:27 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
|
|
|
|
// http://vue-loader.vuejs.org/en/workflow/production.html
|
|
|
|
module.exports.plugins = (module.exports.plugins || []).concat([
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: '"production"'
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
new UglifyJSPlugin({
|
|
|
|
sourceMap: true
|
|
|
|
}),
|
|
|
|
new webpack.LoaderOptionsPlugin({
|
|
|
|
minimize: true
|
|
|
|
})
|
|
|
|
])
|
|
|
|
|
|
|
|
}
|