-
-
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
Building modules (lib) with Vite + Vue3 + Typescript fails #2443
Comments
In general it would be great to have an example of best practice how to use vite to build modules / libs ❤️ |
It looks like the issue origins from duplicate integration of resolve: {
dedupe: ["vue"],
}, This was hard to find. Adding an example to the documentation or the scaffolding code would be very much appreciated. |
I have a similar issue, i try make a lib with ts, vue3 and vite and all works to publish on npm, but when i try to use this on another project, yarn/npm not found on node_modules this package. package: https://github.com/brunokunace/vue3-pix anyone can help? Its my first time making a lib. (accept PR too) |
@brunokunace You refer to |
@holtwick yes, is it, sorry about this stupid question, now all works! |
i reproduced the bug, and the process didn't even report an error.😳 |
Fixes vitejs#2443 Fixes vitejs#7454 It's already been set by default in Nuxt 3 for a while now nuxt/framework#6735 So I think this change should be harmless. And technically it could be considered a fix than a feat. Nevertheless, it's better to ship it in v4 to minimize disruptions on the user side. Things that are not covered in this PR: 1. SSR, because `resolve.dedupe` doesn't work for ESM build outputs, and the CommonJS version is kinda hacky, I think it's better to skip the config for SSR completely. Besides, most related issues are from the client side. 2. #5958 isn't fixed by this PR.
Describe the bug
Building a module with Vite fails when the final product is built (
vite build
). But it works in developer preview (vite
).Reproduction
npm run build
Sample project:
sample.zip
How to use:
/lib
and call:npm install && npm run build
/main
and call:npm install && npm run build && npm run serve
Expected: See output from
lib
component.Actual: No output, but console output from same component shows up. Also works in dev mode, try
npm run dev
.System Info
vite
version: 2.0.5The text was updated successfully, but these errors were encountered: