How to define multiple entry points for RsLib? #3702
-
I am attempting to migrate a project from tsup to rslib, but I don't know how to translate this: import { defineConfig } from "tsup";
export default defineConfig({
entry: {
"utils/index": "src/utils/index.ts",
firebase: "src/firebase.ts",
firestore: "src/firestore.ts",
hash: "src/hash.ts",
redis: "src/redis.ts",
tasks: "src/tasks.ts",
timer: "src/timer.ts",
},
format: ["esm"],
target: "es2022",
sourcemap: true,
}); I can't seem to find anything about defining multiple entries in the docs or source code... |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Rslib can use the source.entry config of Rsbuild, here is an example: export default defineConfig({
lib: [
{
format: 'esm',
source: {
entry: {
foo: './src/foo.ts',
},
},
},
],
}); |
Beta Was this translation helpful? Give feedback.
-
Thanks that kind of worked. But it seems my exports are somehow not getting exported from each of the entries. I was trying to replace tsup with rslib. Maybe I misunderstood the use-case. It doesn't appear to generate the clean ESM output I was hoping for. Is it possible for rslib to output code without all the webpack indirections or is that just inherit to the goal of being a webpack alternative? |
Beta Was this translation helpful? Give feedback.
Rslib can use the source.entry config of Rsbuild, here is an example: