-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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 regression in 2.4.3 #4336
Comments
Would you create a minimal reproduction in github so it is easier for others to check it out? |
Of course, minimal repros don't exhibit the problem. This is gonna be hard :( |
More observations, as I am trying, without success, to isolate this by detaching my full app from its back-end. I don't have the same issue as above, but I have other random failures, such as One minute later: going back-and-forth from 2.4.1 to 2.4.3 (or maybe just restarting Vite a second time?) now triggers the multiple Vue versions issue. Taking a lunch break, I'll try to cut down the project to a minimal bug, maybe I'll manage to provide a repro after all! |
I have not pinpoint a precise, small repro; but I have a glimpse at what is going on. -> The root cause of JS errors such as destructuring -> It seems to happen when Vite encounters new dependencies. Restarting vite seems to fix the issue, until new dependencies are encountered again. Observations on one of my projects:
Hopefully that provides you some indications about what's going on and you can relate it to recent changes. |
@patak-js I will. |
@patak-js That doesn't seem to be it. I reversed #4091 but after each |
@patak-js Here's a repro. To see the bug, from a fresh clone, just do what you usually would:
(This code is tested in Chromium only)
IMHO the underlying problem is that Notice: if you restart Vite, it'll work.
The problem is here again. |
@jods4 there is a problem on default slot on export default defineComponent({
setup(_, { slots }) {
const adorners = sref([] as VNode[]);
listen<MountTarget>("mount", ({ comp, props, children }) => {
const adorner = h(comp, { ...props, key: ++id + "" }, children);
adorners.push(adorner);
return () => remove(adorners, adorner);
});
return () => [slots.default!({}), ...adorners]; // <=== MISSING props {}
},
}); then |
@userquin Thanks but I don't think that's the issue here, don't worry too much about the application itself. It works well enough to demonstrate the Vite issue. The issue is that after upgrading, every time Vite detects new dependencies in node_modules it injects multiple versions of Vue in the app (and nothing works of course). BTW that Suspense warning is a Vue bug, there is a single root. It was marked fixed by Vue team but the PR fixed is still unmerged, see vuejs/core#4016 |
@jods4 but adding props to the default slot just works: |
@userquin It also works "as is", without the props -- you only need to restart Vite to make it work. A missing prop in a component can't cause Vite to serve 2 different versions of Vue at the same time, can it? |
It is really strange, just copying I can see the version Adding |
@jods4 adding all deps causing a full reload on vite config, it seems to work switching popper dep. I see full reload of each dep and seems to be a race condition, there are warnings about Adding esbuild: command !== 'build',
optimizeDeps: {
include: [
'vue',
'vue-router',
'debounce',
'@popperjs/core',
'outdent',
'vite-plugin-svg-sprite/es/runtime',
'popmotion',
'stylefire',
'framesync',
'highlight.js/lib/core',
'highlight.js/lib/languages/javascript',
'highlight.js/lib/languages/xml',
'highlight.js/lib/languages/yaml'
]
},
build: {
target: 'esnext',
outDir: '../Portal/wwwroot',
... |
@userquin I debugged that warning. Basically, one Vue copy is creating components and sets its own -> Restart Vite and everything will be in order again.
That would surely help minimize the issue, because doing so means there is no more dependencies that Vite will find at runtime (which is something that triggers this bug and needs a restart). Then the only trigger of the bug is when you do As far as workarounds go, atm I'm ok with restarting Vite, it's only once and then it doesn't happen anymore. |
@jods4 did you try to add
|
@patak-js No, I did not try that. Maybe it'll help with the bug, but I shouldn't need that if my |
When the error occurs, there are a few duplicate deps, I think it is some dependency that triggers the full reload and then all deps change on tree shake, similar to the router version change; you only need to reproduce the problem and then inspect the .vite entry on source tab on dev tools. |
Small update: I can confirm this still reproduces in latest 2.4.4. |
I tested the repro with Vite 2.8.6 and it looks like it's working fine now. @jods4 Can you confirm if this is fixed on your end? |
Haven't seen it in a while, I must admit. |
Hi @jods4 we're in the process of cleaning up the issues. Wondering if you had managed to verify this yourself? |
Hi @bluwy sorry the planning shifted and I haven't picked up work on said project, should happen this month. |
Given all the changes to dependency pre-bundling in 2.9, I think it is a good idea to close it now. As you said @jods4, it would be great if you find the time to test your project again. Please create a new issue against latest linking to this one if there is still an issue. Thanks! |
Describe the bug
This looks like a Vue or SFC compiler bug, but the only thing that changed (I double-checked by diffing
package-lock.json
) is Vite being upgraded from 2.4.1 to 2.4.3.In 2.4.1 my app works fine.
In 2.4.3 it doesn't start because of this error, straight in my root (App) component:
Where it fails is this SFC generated code:
Reproduction
My App.vue contains this template, which is the (first?) part that fails:
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: