-
-
Notifications
You must be signed in to change notification settings - Fork 158
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Vue acts different locally than production #12
Comments
Because your package depends on vue, rebuilding vue causes the two component states not to share. vite will pre-bundled packages, and the dependent packages do not declare dependent vue, so vite will rebuilding vue.
export default defineConfig({
plugins: [vue()],
optimizeDeps: {
exclude: [
'component-composable'
]
}
}) |
Thanks @poyoho this fixes the issue, wonder if this should be documented somewhere. |
Possibly related to #26 and vitejs/vite#7454 (comment). I wonder if |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
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.
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Describe the bug
I have written a Vue 3 package with a component and a composable, the component uses the composable for logic and is exposed outside the app to be used on other parts of the actual application.
Vite Demo
The code of the implementation can be found here: https://github.com/mmeester/component-composable-demo
Expected behaviour
The state inside and outside the component is changed synchronous (reactive),
Actual local behaviour
❌ Both states are separated and change independently
Build / Production behaviour
✅ Works as expected and can be viewed here: https://unruffled-newton-d68d59.netlify.app/
Vue-CLI
I've also tried to run the same example with the vue CLI to see if this has anything to do with vue or particularly with vite. The code of the vue-cli can be found here: https://github.com/mmeester/component-composable-vue-demo
Expected behaviour
The state inside and outside the component is changed synchronous (reactive),
Actual local behaviour
✅ Works as expected
Build / Production behaviour
✅ Works as expected and can be viewed here: https://hopeful-sammet-11ef56.netlify.app/
Reproduction
npm i
npm run dev
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: