-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathrspack.config.mjs
More file actions
53 lines (51 loc) · 1.21 KB
/
rspack.config.mjs
File metadata and controls
53 lines (51 loc) · 1.21 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
// @ts-check
import path from 'node:path';
import { defineConfig } from '@rspack/cli';
import { rspack } from '@rspack/core';
/** @type {import('@rspack/cli').Configuration} */
export default defineConfig({
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(import.meta.dirname, 'src/legacy'),
type: 'css/auto',
},
{
// files in src/legacy and ends with .css will be CSS Modules
include: path.resolve(import.meta.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',
}),
],
});