This repository was archived by the owner on Jan 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
52 lines (50 loc) · 1.36 KB
/
webpack.config.js
File metadata and controls
52 lines (50 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const path = require('path');
const minifyPlugin = require('babel-minify-webpack-plugin');
const htmlWebpackPlugin = require('html-webpack-plugin');
const scriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
const webpack = require('webpack');
module.exports = {
entry: './src/index.js',
output: {
filename: './bundle.js',
path: path.resolve(__dirname, 'public'),
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new htmlWebpackPlugin({ template: './src/index.pug' }),
new scriptExtHtmlWebpackPlugin({ inline: ['bundle.js'] }),
],
module: {
rules: [
{ test: /\.pug$/, use: 'pug-loader' },
{ test: /\.js$/, use: ['eslint-loader'], enforce: 'pre' },
{ test: /\.js$/, use: ['babel-loader'], exclude: /node_modules/ },
{ test: /\.css$/, use: [ 'style-loader', 'css-loader?minimize' ] },
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
}
},
node: {
Buffer: false
},
devServer: {
disableHostCheck: true,
host: '0.0.0.0',
proxy: {
'*': 'http://127.0.0.1:21877/'
}
},
};
if (process.env.NODE_ENV === 'production') {
module.exports.plugins = module.exports.plugins.concat([
new minifyPlugin({}, { comments: /forOneLine/ }),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
]);
};