-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
/
Copy pathwebpack.config.js
68 lines (67 loc) · 2.05 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const webpackBaseConfig = require('../../webpackBaseConfig');
module.exports = {
...webpackBaseConfig,
entry: path.resolve(__dirname, 'index.js'),
mode: process.env.NODE_ENV || 'development',
optimization: {
// Helps debugging and build perf.
// Bundle size is irrelevant for local serving
minimize: false,
concatenateModules: false,
},
output: {
path: path.resolve(__dirname, './build'),
publicPath: '/',
filename: 'tests.js',
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, './template.html'),
}),
// Avoid bundling the whole @mui/icons-material package. x2 the bundling speed.
new webpack.IgnorePlugin({ resourceRegExp: /material-icons\/SearchIcons\.js/ }),
new webpack.ProvidePlugin({
// required by code accessing `process.env` in the browser
process: 'process/browser.js',
}),
],
module: {
rules: [
{
test: /\.(js|mjs|ts|tsx)$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
cacheDirectory: true,
configFile: path.resolve(__dirname, '../../babel.config.js'),
envName: 'regressions',
},
},
{
test: /\.md$/,
type: 'asset/source',
},
{
test: /\.(jpg|gif|png)$/,
type: 'asset/inline',
},
],
},
resolve: {
...webpackBaseConfig.resolve,
fallback: {
// Exclude polyfill and treat 'fs' as an empty module since it is not required. next -> gzip-size relies on it.
fs: false,
// Exclude polyfill and treat 'stream' as an empty module since it is not required. next -> gzip-size relies on it.
stream: false,
// Exclude polyfill and treat 'zlib' as an empty module since it is not required. next -> gzip-size relies on it.
zlib: false,
},
},
// TODO: 'browserslist:modern'
// See https://github.com/webpack/webpack/issues/14203
target: 'web',
};