-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfont-loader.config.js
51 lines (49 loc) · 1.3 KB
/
font-loader.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
// font-loader.config.js
// returns a webpack config object for handling font loading
// return a webpack config
// eslint-disable-next-line @typescript-eslint/no-unused-vars
module.exports = (type = 'modern', settings) => {
// common config
const common = () => ({
module: {
rules: [
{
test: /\.(ttf|eot|woff2?)$/i,
use: [
{
loader: 'file-loader',
options: {
name: 'fonts/[name].[ext]'
}
}
]
},
],
},
});
// configs
const configs = {
// development configs
development: {
// legacy development config
legacy: {
},
// modern development config
modern: {
...common(),
},
},
// production configs
production: {
// legacy production config
legacy: {
...common(),
},
// modern production config
modern: {
...common(),
},
}
};
return configs[process.env.NODE_ENV][type];
}