-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.parts.js
89 lines (82 loc) · 1.72 KB
/
webpack.parts.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
81
82
83
84
85
86
87
88
89
exports.loadCSS = ({ include, exclude } = {}) => ({
module: {
rules: [
{
test: /\.css$/,
include,
exclude,
use: ['style-loader', 'css-loader'],
},
],
},
});
exports.loadJavaScript = ({ include, exclude } = {}) => ({
module: {
rules: [
{
test: /\.js$/,
include,
exclude,
use: 'babel-loader',
},
],
},
});
exports.loadSnapSVG = () => ({
module: {
rules: [
{
test: require.resolve('snapsvg'),
loader: 'imports-loader?this=>window,fix=>module.exports=0',
}
]
}
});
exports.loadFontkit = () => ({
module: {
rules: [
{
test: /fontkit[/\\]index.js$/,
loader: 'transform-loader?brfs',
enforce: 'post',
},
{
test: /unicode-properties[/\\]index.js$/,
loader: 'transform-loader?brfs',
enforce: 'post',
},
{
test: /linebreak[/\\]src[/\\]linebreaker.js/,
loader: 'transform-loader?brfs',
enforce: 'post',
},
],
},
});
exports.loadWebfont = () => ({
module: {
rules: [
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'url-loader',
}
]
}
});
exports.devServer = ({ host, port } = {}) => ({
devServer: {
// Display only errors to reduce the amount of output.
stats: "errors-only",
// Parse host and port from env to allow customization.
//
// If you use Docker, Vagrant or Cloud9, set
// host: "0.0.0.0";
//
// 0.0.0.0 is available to all network devices
// unlike default `localhost`.
host, // Defaults to `localhost`
port, // Defaults to 8080
open: true, // Open the page in browser
overlay: true,
},
});