-
Notifications
You must be signed in to change notification settings - Fork 2
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
[WIP] feat(hmr) #58
base: master
Are you sure you want to change the base?
[WIP] feat(hmr) #58
Conversation
Looks great to me. Could you pls check if build script works? I am a bit aware of that because of plugins in default config |
js/manager.js
Outdated
@@ -1 +1,5 @@ | |||
require('../components/sandbox-manager/sandbox-manager'); | |||
|
|||
if (module.hot) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need hot reload in manager? Seems like only in preview should be enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats right
So, should we remove that redundant 3 lines and finally merge it? What about build script? Works? |
build script works and the files generated are also fine. though there is a 404 for HMR request |
yep, that's what i was afraid of. seems like it could be fixed by moving hmr stuff (where you extend default config with hmr plugins and dependencies) from here https://github.com/modulor-js/modulor-storybook/blob/master/server.js#L44 . Just extend the config before applying it |
any news here? =) |
still working on it. |
I think you need to apply hmr only for preview (always reloading main page makes no sense anyway). To do so, you'll first need to take a solution from my comment above:
Then, apply hot middleware only for preview: app.get('/preview.html', webpackHotMiddleware(compiler)); hope this helps |
I did similar already but the change is not on github. The issue is about redefining the component when something is changed. When we save the component file with changes, the whole file is sent back to preview client and re-evaluated. Now on re-evaluate, it will throw error because the Browser has already defined the component's tag name for that class. And that's what the screenshot is showing. One way to mitigate this error can be to move all the |
The initial idea for HMR in storybook