parent
d3b5a77efb
commit
f180a9cc5a
File diff suppressed because it is too large
Load Diff
@ -1,70 +1,55 @@ |
||||
var path = require('path') |
||||
var webpack = require('webpack') |
||||
const TerserPlugin = require('terser-webpack-plugin'); |
||||
// Generated using webpack-cli https://github.com/webpack/webpack-cli
|
||||
|
||||
module.exports = { |
||||
mode: 'production', |
||||
entry: { |
||||
bundle: [ |
||||
'./src/main.js', |
||||
], |
||||
style: [ |
||||
'./src/style.js', |
||||
] |
||||
}, |
||||
output: { |
||||
path: path.resolve(__dirname, './static/dist'), |
||||
publicPath: '/dist/', |
||||
filename: '[name].min.js' |
||||
}, |
||||
module: { |
||||
rules: [ |
||||
{ |
||||
test: /\.css$/, |
||||
use: [ |
||||
'vue-style-loader', |
||||
'css-loader' |
||||
], |
||||
}, |
||||
const path = require('path'); |
||||
|
||||
const isProduction = process.env.NODE_ENV == 'production'; |
||||
|
||||
{ |
||||
test: /\.js$/, |
||||
loader: 'babel-loader', |
||||
exclude: /node_modules/ |
||||
} |
||||
|
||||
] |
||||
}, |
||||
resolve: { |
||||
alias: { |
||||
'vue$': 'vue/dist/vue.esm.js' |
||||
const config = { |
||||
entry: { |
||||
bundle: [ |
||||
'./src/main.js', |
||||
], |
||||
style: [ |
||||
'./src/style.js', |
||||
] |
||||
}, |
||||
output: { |
||||
path: path.resolve(__dirname, './static/dist'), |
||||
publicPath: '/dist/', |
||||
filename: '[name].min.js' |
||||
}, |
||||
extensions: ['*', '.js', '.vue', '.json'] |
||||
}, |
||||
devServer: { |
||||
historyApiFallback: true, |
||||
noInfo: true, |
||||
overlay: true |
||||
}, |
||||
performance: { |
||||
hints: false |
||||
}, |
||||
} |
||||
plugins: [ |
||||
], |
||||
module: { |
||||
rules: [ |
||||
{ |
||||
test: /\.css$/, |
||||
use: [ |
||||
'vue-style-loader', |
||||
'css-loader' |
||||
], |
||||
}, |
||||
{ |
||||
test: /\.js$/, |
||||
exclude: /node_modules/, |
||||
loader: 'babel-loader', |
||||
options: { |
||||
presets: ['@babel/preset-env'] |
||||
} |
||||
}, |
||||
], |
||||
}, |
||||
resolve: { |
||||
alias: { |
||||
'vue$': 'vue/dist/vue.esm.js' |
||||
}, |
||||
extensions: ['*', '.js', '.vue', '.json'] |
||||
}, |
||||
}; |
||||
|
||||
module.exports = () => { |
||||
config.mode = 'production'; |
||||
|
||||
if (process.env.NODE_ENV === 'production') { |
||||
module.exports.devtool = 'false' |
||||
// 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 TerserPlugin({ |
||||
sourceMap: false |
||||
}), |
||||
new webpack.LoaderOptionsPlugin({ |
||||
minimize: true |
||||
}) |
||||
]) |
||||
} |
||||
return config; |
||||
}; |
||||
|
Loading…
Reference in new issue