2018-02-19 23:46:04 +00:00
|
|
|
var path = require('path')
|
|
|
|
var webpack = require('webpack')
|
|
|
|
|
|
|
|
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|svg)$/,
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: { name: '[name].[ext]?[hash]' }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = [ {
|
|
|
|
|
|
|
|
name: "home",
|
|
|
|
entry: './webpack/page/home.js',
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, './public_html/js/bundle'),
|
|
|
|
publicPath: '/js/bundle/',
|
2018-02-21 18:34:41 +00:00
|
|
|
filename: 'home@0.js'
|
2018-02-19 23:46:04 +00:00
|
|
|
},
|
|
|
|
module: mod_common,
|
|
|
|
devtool: '#eval-source-map'
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
|
|
name: "login",
|
|
|
|
entry: './webpack/page/login.js',
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, './public_html/js/bundle'),
|
|
|
|
publicPath: '/js/bundle/',
|
2018-02-21 18:34:41 +00:00
|
|
|
filename: 'login@0.js'
|
2018-02-19 23:46:04 +00:00
|
|
|
},
|
|
|
|
module: mod_common,
|
|
|
|
devtool: '#eval-source-map'
|
|
|
|
|
|
|
|
} ]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
module.exports.devtool = '#source-map'
|
|
|
|
// 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 webpack.optimize.UglifyJsPlugin({
|
|
|
|
sourceMap: true,
|
|
|
|
compress: {
|
|
|
|
warnings: false
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
new webpack.LoaderOptionsPlugin({
|
|
|
|
minimize: true
|
|
|
|
})
|
|
|
|
])
|
|
|
|
}
|