-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
80 lines (79 loc) · 1.79 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
68
69
70
71
72
73
74
75
76
77
78
79
80
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
var outputPath = path.normalize('C:distdigitalCV');
var TerserPlugin = require('terser-webpack-plugin');
module.exports = {
entry: {
bundle: './src/index.js'
},
devServer: {
contentBase: outputPath,
compress: true,
port: 3000,
historyApiFallback: true
},
optimization: {
minimizer: [
new TerserPlugin({
extractComments: true
})
]
},
output: {
filename: 'bundle.js',
path: path.join(__dirname, '/dist')
},
module: {
rules: [
{
test: /\.js$/, // include .js files
enforce: 'pre', // preload the jshint loader
exclude: __dirname + '/node_modules',
loader: 'babel-loader'
},
{
test: /\.css$/,
exclude: __dirname + '/node_modules',
use: [
{ loader: 'style-loader' },
{
loader: 'css-loader',
options: {
url: true
}
}
]
},
{
test: /\.(png|svg|jpg|jpeg|gif|ico)$/,
exclude: __dirname + '/node_modules',
use: ['file-loader?name=[name].[ext]'] // ?name=[name].[ext] is only necessary to preserve the original file name
},
{
test: /\.(ttf|eot|woff|woff2)$/,
exclude: __dirname + '/node_modules',
use: {
loader: 'file-loader',
options: {
outputPath: 'fonts',
name: '[name].[ext]',
publicPath: 'fonts'
}
}
},
{
test: /\.json$/,
loader: 'json-loader'
}
]
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.join(__dirname, 'src', 'index.html')
})
],
stats: {
colors: true
}
};