-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathrolldown.config.mjs
More file actions
24 lines (23 loc) · 924 Bytes
/
Copy pathrolldown.config.mjs
File metadata and controls
24 lines (23 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import ttsc from "@ttsc/unplugin/rolldown";
import path from "node:path";
import { globSync } from "tinyglobby";
// The `.mjs` build feeds the TypeScript sources straight to rolldown, which
// transpiles them natively; `@ttsc/unplugin` applies the project's ttsc
// plugins on the way in. `preserveModules` keeps the 1:1 module layout, so
// every `lib/<path>.js` from the main ttsc build gets a genuine ESM twin at
// `lib/<path>.mjs` — named exports intact, no facade chunks, no CommonJS
// transcoding. Everything outside `src/` is an external module, including the
// package's type-only imports of itself.
export default {
input: globSync("./src/**/*.ts"),
external: (id) => !id.startsWith(".") && !path.isAbsolute(id),
output: {
dir: "./lib",
format: "esm",
sourcemap: true,
entryFileNames: "[name].mjs",
preserveModules: true,
preserveModulesRoot: "src",
},
plugins: [ttsc()],
};