-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
96 lines (91 loc) · 1.75 KB
/
Copy pathwebpack.config.js
File metadata and controls
96 lines (91 loc) · 1.75 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
'use strict';
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const SRC_PATH = path.resolve(__dirname, 'src/client');
const STATIC_PATH = path.resolve(__dirname, 'public');
const BUILD_PATH = path.resolve(__dirname, 'dist/static');
module.exports = {
// GENERAL CONFIG
//
mode: process.env.NODE_ENV || 'development',
entry: path.resolve(SRC_PATH, 'index.js'),
output: {
filename: 'app.js',
path: BUILD_PATH,
publicPath: '/',
},
resolve: {
alias: {
'@': SRC_PATH,
},
},
module: {
rules: [{
// images
test: /\.(png|jpe?g|gif|webp|svg)(\?.*)?$/i,
use: [{
loader: 'file-loader',
options: {
name: 'img/[name].[hash:8].[ext]',
},
}]
}, {
// fonts
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/i,
use: [{
loader: 'file-loader',
options: {
name: 'fonts/[name].[hash:8].[ext]',
},
}]
}, {
// Vue components
test: /\.vue$/,
loader: 'vue-loader',
}, {
// LESS files
test: /\.less$/,
use: [
'vue-style-loader',
'css-loader',
'less-loader',
]
}, {
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader',
]
}],
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(STATIC_PATH, 'index.html'),
}),
new CopyWebpackPlugin({
patterns: [{
from: STATIC_PATH,
to: BUILD_PATH,
toType: 'dir',
globOptions: {
ignore: ['.DS_Store']
},
}]
}),
new VueLoaderPlugin(),
],
// DEV CONFIG
//
devtool: 'inline-source-map',
devServer: {
open: false,
port: 8080,
contentBase: BUILD_PATH,
compress: true,
hot: true,
liveReload: false,
overlay: true,
},
};