-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
80 lines (77 loc) · 1.6 KB
/
webpack.config.js
File metadata and controls
80 lines (77 loc) · 1.6 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
const path = require('path');
const { sync: glob } = require('glob');
const context = path.join(__dirname, 'src');
const pkg = require('./package.json');
const mode = process.env.NODE_ENV || 'development';
const entry = [
path.join(context, `${pkg.name}.js`)
].concat(
mode !== 'production' ? glob('**/*.html', {
cwd: path.join(__dirname, 'test/fixtures'),
absolute: true
}) : []
);
module.exports = {
context,
mode,
entry,
output: {
filename: `${pkg.name}.js`,
path: path.join(__dirname, 'dist')
},
module: {
rules: [{
test: /\.m?js$/,
exclude: /node_modules\/(?!(unique-selector)\/).*/,
use: {
loader: 'babel-loader',
options: {
presets: [ '@babel/preset-env' ],
plugins: [
// '@babel/transform-runtime',
'@babel/plugin-transform-spread'
]
}
}
}, {
test: /\.html$/,
use: [{
loader: 'file-loader',
options: {
emitFile: true,
name: '[name].html'
}
}, {
loader: 'extract-loader'
}, {
loader: 'html-loader',
options: {
attrs: [
'script:src'
]
}
}]
}]
},
resolve: {
alias: {
[pkg.name]: path.resolve(__dirname, pkg.name)
}
},
optimization: {
minimize: false
},
devServer: {
index: 'index.html',
open: true,
//hot: true,
inline: true,
port: 3010,
historyApiFallback: true,
//contentBase: path.join(process.cwd(), 'src'),
contentBase: './dist',
stats: {
colors: true
}
}
};