-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
110 lines (109 loc) · 4.1 KB
/
webpack.config.js
File metadata and controls
110 lines (109 loc) · 4.1 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
const path = require('path');
module.exports = (_, argv) => {
return {
entry: path.resolve(__dirname, 'src', 'index.js'),
resolve: {
extensions: ['.jsx', '.js', '.json']
},
output: {
filename: 'bundle.js',
path: path.resolve('dist'),
clean: true,
publicPath: '/dist/',
libraryTarget: 'umd',
umdNamedDefine: true
},
resolve: {
alias: {
react: path.resolve(__dirname, './node_modules/react'),
'react-dom': path.resolve(__dirname, './node_modules/react-dom')
}
},
externals: {
react: 'react',
'react-dom': 'react-dom'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react']
}
}
},
{
test: /\.(css)$/i,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
// Run `postcss-loader` on each CSS `@import`, do not forget that `sass-loader` compile non CSS `@import`'s into a single file
// If you need run `sass-loader` and `postcss-loader` on each CSS `@import` please set it to `2`
importLoaders: 1,
// Automatically enable css modules for files satisfying `/\.module\.\w+$/i` RegExp.
modules: { auto: true }
}
}
]
},
{
test: /\.((sa|sc)ss)$/i,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
// Run `postcss-loader` on each CSS `@import`, do not forget that `sass-loader` compile non CSS `@import`'s into a single file
// If you need run `sass-loader` and `postcss-loader` on each CSS `@import` please set it to `2`
importLoaders: 1,
// Automatically enable css modules for files satisfying `/\.module\.\w+$/i` RegExp.
modules: { auto: true }
}
},
{
loader: 'sass-loader',
options: {
// Prefer `dart-sass`
// eslint-disable-next-line global-require
implementation: require('sass')
}
}
]
},
{
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {
svgoConfig: {
plugins: [
{
removeViewBox: false
}
]
}
}
}
]
},
{
test: /\.(png|jpe?g|gif|webp)$/i,
use: [
{
loader: 'file-loader'
}
]
}
]
},
watchOptions: {
ignored: ['**/node_modules']
}
};
};