2020-05-14 19:13:33 -04:00
|
|
|
var path = require('path')
|
|
|
|
var webpack = require('webpack')
|
2020-10-29 06:50:19 -04:00
|
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
2020-05-14 19:13:33 -04:00
|
|
|
|
|
|
|
module.exports = {
|
2021-02-26 07:11:13 -05:00
|
|
|
mode: 'production',
|
|
|
|
entry: {
|
|
|
|
bundle: [
|
|
|
|
'./src/main.js',
|
|
|
|
],
|
|
|
|
style: [
|
|
|
|
'./src/style.js',
|
|
|
|
]
|
|
|
|
},
|
2020-05-14 19:13:33 -04:00
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, './static/dist'),
|
|
|
|
publicPath: '/dist/',
|
2021-02-26 07:11:13 -05:00
|
|
|
filename: '[name].min.js'
|
2020-05-14 19:13:33 -04:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
'vue-style-loader',
|
|
|
|
'css-loader'
|
|
|
|
],
|
|
|
|
},
|
2021-02-26 07:11:13 -05:00
|
|
|
|
2020-05-14 19:13:33 -04:00
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel-loader',
|
|
|
|
exclude: /node_modules/
|
|
|
|
}
|
2021-02-26 07:11:13 -05:00
|
|
|
|
2020-05-14 19:13:33 -04:00
|
|
|
]
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'vue$': 'vue/dist/vue.esm.js'
|
|
|
|
},
|
|
|
|
extensions: ['*', '.js', '.vue', '.json']
|
|
|
|
},
|
|
|
|
devServer: {
|
|
|
|
historyApiFallback: true,
|
|
|
|
noInfo: true,
|
|
|
|
overlay: true
|
|
|
|
},
|
|
|
|
performance: {
|
|
|
|
hints: false
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
2021-02-26 07:11:13 -05:00
|
|
|
module.exports.devtool = 'false'
|
2020-05-14 19:13:33 -04:00
|
|
|
// http://vue-loader.vuejs.org/en/workflow/production.html
|
|
|
|
module.exports.plugins = (module.exports.plugins || []).concat([
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: '"production"'
|
|
|
|
}
|
|
|
|
}),
|
2020-10-29 06:50:19 -04:00
|
|
|
new TerserPlugin({
|
2021-02-26 07:11:13 -05:00
|
|
|
sourceMap: false
|
2020-05-14 19:13:33 -04:00
|
|
|
}),
|
|
|
|
new webpack.LoaderOptionsPlugin({
|
|
|
|
minimize: true
|
|
|
|
})
|
|
|
|
])
|
|
|
|
}
|