-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please support multiple entry points for library mode #4530
Comments
I was looking for this :( thought its already there and seems we still far behind |
In vite v2, this is possible with
Per #9086, this currently no longer works in vite v3. |
I just want to point out that now, Vite respects My attempt: import { defineConfig } from "vite";
export default defineConfig({
build: {
emptyOutDir: false,
outDir: "dist",
sourcemap: true,
lib: {
// fileName,
formats: ["cjs", "es"],
},
rollupOptions: {
input: {
"math.js": "./src/math.ts",
"logger.js": "./src/logger.ts",
},
},
},
}); Vite won't respect the given input alias (
Repro repository: https://github.com/raulfdm/vite-3-lib-multiple-entrypoints/tree/main/packages/using-rollup-input-vite-313 |
Hi @raulfdm 😀 export default defineConfig({
build: {
emptyOutDir: false,
outDir: "dist",
sourcemap: true,
lib: {
fileName: "[name]",,
formats: ["cjs", "es"],
},
rollupOptions: {
input: {
"math": "./src/math.ts",
"logger": "./src/logger.ts",
},
},
},
}); I hope that was helpful, happy coding and have a good day 😊 |
hey @abdelkrimdev ... that works indeed. Thank you so much for the clarification and for the time to help me out. |
Clear and concise description of the problem
Clear and concise description of the problem
I'm using Vite.js to build a webcomponent library for a customer.
This does perfectly create the desired output:
In the same project, we also build the application that uses this library, which basically comprises of web components as well, which serve as views. So I need a second entry point:
Unfortunately, that results in an error:
Suggested solution
Instead of a single entry point for libarary mode, allow an array of entry points.
Alternative
I've tried working around this limitation by using
rollupOptions
instead, but wasn"t able to figure it out:Unfortunately, this does not create the files I expect:
Additional context
I've read and upvoted #1736 and wanted to turn this into a feature request.
Validations
The text was updated successfully, but these errors were encountered: