Repository navigation
Expand file tree
/
Copy pathrolldown.config.ts
More file actions
58 lines (54 loc) · 1.67 KB
/
Copy pathrolldown.config.ts
File metadata and controls
58 lines (54 loc) · 1.67 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
import { rmSync } from 'node:fs';
import { defineConfig } from 'rolldown';
// A fresh dist/ on every build, the declarations included.
rmSync('dist', { recursive: true, force: true });
// The oldest Node the package supports (engines).
const transform = { target: 'node22.12' };
const external = [
'@babel/core',
'@solidjs/compiler',
'@ampproject/remapping',
'@solidjs/babel-plugin',
'merge-anything',
'vitefu',
'magic-string',
'vite',
];
export default defineConfig([
{
input: 'src/index.ts',
platform: 'node',
transform,
external,
// ESM only: Vite is ESM-only, and the Node versions the plugin supports
// (22.12+) load this build through require() too.
output: {
format: 'esm',
file: 'dist/esm/index.mjs',
sourcemap: true,
},
},
/**
* The runtime of the Node server entry `start.nodeServer` emits into a
* build's dist/server/node.js: the plugin reads this artifact at build time
* and prepends the emit-time constants. Bundles the shared node<->web
* bridge (src/http.ts) with it; `./server.js` (the sibling server bundle)
* stays an external import, kept verbatim so it resolves in the user's
* dist. Comments are stripped: this file lands in every user's dist, and
* the source files keep the explanations.
*/
{
input: 'src/node-entry/index.ts',
platform: 'node',
transform,
external: (id) => id === './server.js' || id.startsWith('node:'),
makeAbsoluteExternalsRelative: false,
// No `// <module id>` markers either.
experimental: { attachDebugInfo: 'none' },
output: {
format: 'esm',
file: 'dist/node-entry.mjs',
comments: false,
},
},
]);