-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
80 lines (73 loc) · 1.71 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 resouceLoader = ({ test, type, isServer }) => ({
test,
use: [
{
loader: 'url-loader',
options: {
limit: 8192,
fallback: 'file-loader',
publicPath: `/_next/static/${type}/`,
outputPath: `${isServer ? '../' : ''}static/${type}/`,
name: '[name]-[hash].[ext]'
}
}
]
});
const fontsLoader = isServer =>
resouceLoader({
test: /\.(eot|ttf|woff|woff2)$/,
type: 'fonts',
isServer
});
const imageLoader = isServer =>
resouceLoader({
type: 'images',
test: /\.(png|jpg|gif)$/,
isServer
});
const cssLoader = isServer =>
resouceLoader({
type: 'style',
test: /\.(css)$/,
isServer
});
const mp3Loader = isServer =>
resouceLoader({
type: 'audio',
test: /\.(mp3)$/,
isServer
});
const gltfLoader = isServer =>
resouceLoader({
type: 'model',
test: /\.(gltf)$/,
isServer
});
module.exports = {
config: {
resolve: {
alias: {
components: path.resolve(__dirname, './components'),
constants: path.resolve(__dirname, './constants'),
context: path.resolve(__dirname, './context'),
core: path.resolve(__dirname, './core'),
utils: path.resolve(__dirname, './utils'),
validation: path.resolve(__dirname, './validation'),
theme: path.resolve(__dirname, './core/theme'),
services: path.resolve(__dirname, './services'),
sources: path.resolve(__dirname, './sources'),
graphQL: path.resolve(__dirname, './graphql'),
public: path.resolve(__dirname, './public')
}
},
node: {
fs: 'empty'
}
},
imageLoader,
fontsLoader,
cssLoader,
mp3Loader,
gltfLoader
};