-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
Copy pathrolldown.config.js
41 lines (40 loc) · 1012 Bytes
/
rolldown.config.js
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
// @ts-check
import { isAbsolute } from 'node:path';
import wyw from '@wyw-in-js/rollup';
import pkg from './package.json' with { type: 'json' };
import { defineConfig } from 'rolldown';
export default defineConfig({
input: './src/index.ts',
output: [
{
dir: 'lib',
entryFileNames: 'bundle.js',
cssEntryFileNames: 'styles.css',
format: 'es',
sourcemap: true
},
{
dir: 'lib',
entryFileNames: 'bundle.cjs',
cssEntryFileNames: 'styles.css',
format: 'cjs',
sourcemap: true
}
],
platform: 'browser',
external: (id) => !id.startsWith('.') && !isAbsolute(id),
plugins: [
// @ts-expect-error
wyw({
preprocessor: 'none',
/**
* @param {string} hash
*/
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('.', '-')}`;
}
})
]
});