-
Notifications
You must be signed in to change notification settings - Fork 8
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
HMR does not work properly with class components #75
Comments
@UROjQ6r80p I can't seem to reproduce this myself. Could you share the result of running:
Also what operating system and browser you are using? |
Before I've tried the latest version of marko packages and vite. Here is the result:
System: Windows 10. Browser: Brave, but also tried Chrome, Firefox, Opera. Basically what I'm doing is constantly adding few letters in the button, then removing it, then adding, then removing, and it always shows outdated component. hmr.mp4I've tried to reproduce it on StackBlitz https://stackblitz.com/edit/github-fxezeu?file=src%2Fcomponents%2Fapp-button%2Findex.marko and it seems to work without problems so i guess it's related to Windows specifically. Additionally, for example this url: I tried to locally change this line at https://github.com/marko-js/vite/blob/main/src/index.ts
and after this change it seems to always show updated version, but i dont know how it affects the rest of the code. |
I'm running into this issue as well. Also on Windows. |
Actually @UROjQ6r80p I was just able to fix this. I turned off "linked" mode and it seemed to work now. At the root of my project, I have a import { defineConfig } from "vite";
import marko from "@marko/run/vite";
export default defineConfig({
plugins: [
marko({
linked: false,
}),
],
}); |
@danbarbarito by turning There may well be a windows specific issue here, I need to take some time to check 😓. I wonder if it's got differently normalized file names here 🤔 |
@danbarbarito I think it may work if we change https://github.com/marko-js/vite/blob/main/src/index.ts#L400 to |
@DylanPiercey My node_modules only has the |
@danbarbarito probably simplest to just edit the dist. |
@DylanPiercey That didnt work for me unfortunately 😢 |
Shoot. I'll have to get a windows vm setup again so I can test properly. |
Ok, I appreciate you looking into it. If its easier for us to get on a call and have me share my screen as you tell me the changes to make just let me know. |
Wait I messed up before! It works @DylanPiercey ! I guess I didn't restart Vite before or something. Sorry for the confusion. |
Oh that's awesome. Allow me to do a quick release then! |
Should be fixed in 4.1.7 |
Version: x.x.x
2.4.8
Details
HMR does not work properly with class components.
I use npx @marko/create -> vite-express -> npm install @marko/vite@latest
HMR does not work properly with class components.
In vite-express starter, by default there is component
app-button
if i try to add random<span>test</span>
to it, the console shows:[vite] hmr update /src/components/app-button/index.marko?marko-browser, /src/components/app-button/index.marko
but component isn't reloaded correctly in the browser. It shows the outdated version even after manually refreshing the browser.
For components without class, for example
app-layout
it seems to always work, and then console shows[vite] page reload src/components/app-layout/index.marko
Expected Behavior
Component should be replaced to the new version
Actual Behavior
above.
Possible Fix
Additional Info
Your Environment
Steps to Reproduce
Stack Trace
The text was updated successfully, but these errors were encountered: