-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathrolldown.config.ts
More file actions
44 lines (42 loc) · 1.06 KB
/
rolldown.config.ts
File metadata and controls
44 lines (42 loc) · 1.06 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
import { isAbsolute } from 'node:path';
import react from '@vitejs/plugin-react';
import wyw from '@wyw-in-js/rollup';
import { defineConfig } from 'rolldown';
import { dts } from 'rolldown-plugin-dts';
import pkg from './package.json' with { type: 'json' };
export default defineConfig({
input: './src/index.ts',
output: {
dir: 'lib',
cssEntryFileNames: 'styles.css',
sourcemap: true
},
platform: 'browser',
external: (id) => !id.startsWith('.') && !isAbsolute(id),
plugins: [
react({
babel: {
plugins: [
[
'babel-plugin-react-compiler',
{
panicThreshold: 'all_errors'
}
]
]
}
}),
dts({
tsconfig: './tsconfig.lib.json'
}),
wyw({
exclude: ['**/*.d.ts'],
preprocessor: 'none',
classNameSlug(hash) {
// We add the package version as suffix to avoid style conflicts
// between multiple versions of RDG on the same page.
return `${hash}${pkg.version.replaceAll('.', '-')}`;
}
})
]
});