-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrslib.config.ts
More file actions
67 lines (65 loc) · 1.59 KB
/
rslib.config.ts
File metadata and controls
67 lines (65 loc) · 1.59 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
import { pluginReact } from '@rsbuild/plugin-react';
import { pluginSass } from '@rsbuild/plugin-sass';
import { pluginSvgr } from '@rsbuild/plugin-svgr';
import { defineConfig } from '@rslib/core';
import { pluginPublint } from 'rsbuild-plugin-publint';
const COMMON_EXTERNALS = [
'virtual-routes',
'virtual-search-index-hash',
'virtual-site-data',
'virtual-global-styles',
'virtual-global-components',
'virtual-search-hooks',
'@rspress/runtime',
'@theme',
/@theme-assets\//,
'virtual-i18n-text',
// To be externalized when bundling d.ts.
'@types/react',
];
export default defineConfig({
plugins: [pluginPublint()],
lib: [
{
bundle: false,
dts: {
bundle: true,
},
plugins: [
pluginReact(),
pluginSvgr({ svgrOptions: { exportType: 'default' } }),
pluginSass(),
],
format: 'esm',
syntax: 'es2015',
source: {
define: {
__WEBPACK_PUBLIC_PATH__: '__webpack_public_path__',
},
entry: {
index: ['./src/**'],
},
},
tools: {
rspack: {
output: {
environment: {
// For Circular import of "@theme", https://github.com/web-infra-dev/rsbuild/issues/2862
const: false,
},
},
},
},
output: {
target: 'web',
externals: COMMON_EXTERNALS,
cssModules: {
localIdentName: '[local]_[hash:hex:5]',
namedExport: false,
exportLocalsConvention: 'camelCaseOnly',
},
injectStyles: true,
},
},
],
});