-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrspack.config.js
More file actions
64 lines (63 loc) · 1.4 KB
/
Copy pathrspack.config.js
File metadata and controls
64 lines (63 loc) · 1.4 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
const path = require('path');
const isCI = process.env.CI === 'true';
const isSCM = !!process.env.BUILD_BRANCH;
const isProd = process.env.NODE_ENV === 'production';
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
mode: process.env.NODE_ENV,
context: __dirname,
target: ['web'],
entry: {
main: './src/app.tsx',
},
resolve: {
alias: {
react: require.resolve('react'),
'react-dom': require.resolve('react-dom'),
},
},
builtins: {
// https://www.rspack.dev/config/builtins.html#builtinshtml
html: [
{
template: './index.html',
},
],
progress: !isSCM ? {} : false,
treeShaking: isProd,
},
module: {
// https://www.rspack.dev/config/module.html#rule
rules: [
{
test: /\.(png|gif|jpg|jpeg|svg|woff2)$/,
type: 'asset',
},
{
test: /\.(less|css)$/,
use: [
{
loader: 'less-loader',
options: {
// ...
},
},
],
type: 'css',
},
],
},
plugins: [],
/** module is too large now, we may need better way to tackle this in the future */
stats: isCI
? { all: false, modules: true, assets: true, chunks: true, warnings: true, errors: true }
: {
modules: false,
all: false,
warnings: false,
errors: true,
timings: true,
},
};