-
-
Notifications
You must be signed in to change notification settings - Fork 241
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
49 lines (48 loc) · 1.25 KB
/
tsdown.config.ts
File metadata and controls
49 lines (48 loc) · 1.25 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
import fs from 'node:fs'
import { defineConfig } from 'tsdown'
export default defineConfig({
entry: [
'src/index.ts',
'src/plugin.ts',
'src/browser.ts',
'src/ssr.tsx',
'src/rsc.tsx',
'src/core/browser.ts',
'src/core/ssr.ts',
'src/core/rsc.ts',
'src/core/plugin.ts',
'src/react/browser.ts',
'src/react/ssr.ts',
'src/react/rsc.ts',
'src/transforms/index.ts',
'src/plugins/cjs.ts',
'src/utils/rpc.ts',
'src/utils/encryption-runtime.ts',
],
format: ['esm'],
// TODO: specify explicitly
inlineOnly: false,
fixedExtension: false,
external: [/^virtual:/, /^@vitejs\/plugin-rsc\/vendor\//],
dts: {
sourcemap: process.argv.slice(2).includes('--sourcemap'),
},
plugins: [
{
name: 'vendor-react-server-dom',
buildStart() {
fs.rmSync('./dist/vendor/', { recursive: true, force: true })
fs.mkdirSync('./dist/vendor', { recursive: true })
fs.cpSync(
'./node_modules/react-server-dom-webpack',
'./dist/vendor/react-server-dom',
{ recursive: true, dereference: true },
)
fs.rmSync('./dist/vendor/react-server-dom/node_modules', {
recursive: true,
force: true,
})
},
},
],
}) as any