-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
67 lines (61 loc) · 1.62 KB
/
webpack.config.js
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const {VueLoaderPlugin} = require('vue-loader')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
module.exports = {
mode: 'development', /* or production */
entry: {
app: './src/main.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].bundle.js', /* compiles to app.bundle.js */
clean: true
},
optimization: {
minimize: false, /* enables or disables minified js output */
splitChunks: {
chunks: 'all', /* use different output file for app and runtime */
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors' /* compiles to vendors.bundle */
}
}
}
},
plugins: [
new HtmlWebpackPlugin({
template: './public/index.html',
title: 'Vue2 application', /* sets document title */
inject: 'body', /* puts script tag inside document's body */
publicPath: '', /* base path of assets url */
scriptLoading: 'blocking',
minify: false /* minifies html output */
}),
new VueLoaderPlugin(),
new MiniCssExtractPlugin({
filename: '[name].bundle.css' /* compiles style tags from vue templates */
})
],
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.css$/,
use: [ /* must be in the correct order */
MiniCssExtractPlugin.loader,
'css-loader'
]
}
]
},
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 9000
}
}