-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathrspack.config.js
More file actions
52 lines (50 loc) · 1.15 KB
/
rspack.config.js
File metadata and controls
52 lines (50 loc) · 1.15 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
const path = require('path');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: './src/index.js',
module: {
parser: {
'css/auto': {
namedExports: true, // default value is true since v0.6.0
},
},
generator: {
'css/auto': {
exportsConvention: 'as-is',
localIdentName: '[hash]-[local]',
},
},
rules: [
{
test: /\.css$/,
exclude: path.resolve(__dirname, 'src/legacy'),
type: 'css/auto',
},
{
// files in src/legacy and ends with .css will be CSS Modules
include: path.resolve(__dirname, 'src/legacy'),
test: /\.css$/,
type: 'css/module',
parser: {
namedExports: false,
},
generator: {
exportsConvention: 'camel-case',
localIdentName: '[path][name][ext]__[local]',
},
},
{
test: /\.scss$/,
use: 'sass-loader',
type: 'css/auto',
},
],
},
plugins: [
new rspack.HtmlRspackPlugin({
template: './index.html',
}),
],
};
module.exports = config;