question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Questions: Web components HMR for v5.3.4

See original GitHub issue

Dear Maintainers,

With v5.3.x came new setup, particularly, import stories into main.js. Thus HMR approach for Web Components no longer works for '@storybook/html' Are there any workarounds?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:19 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
steelcommented, Mar 25, 2020

I’ll put up a PR

1reaction
dakomcommented, Dec 8, 2020

For vanilla storybook (e.g. html) here’s a workaround for live reload in the meantime.

  1. npm install --save-dev webpack-livereload-plugin

  2. In .storybook/main.js:

    2a. const LiveReloadPlugin = require('webpack-livereload-plugin');

    2b. Edit the webpack config. config, here is the thing passed to webpackFinal in module.exports

    //remove HMR
    config.plugins = config.plugins.filter(plugin => plugin.constructor.name != "HotModuleReplacementPlugin");
    config.entry = config.entry.filter(entry => entry.indexOf("webpack-hot-middleware") === -1);
    
    //Add LiveReload
    config.plugins.push(new LiveReloadPlugin());
    
  3. In .storybook/preview-head.html add: <script src="http://localhost:35729/livereload.js"></script>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Web Components - MDN Web Docs - Mozilla
Web Components is a suite of different technologies allowing you to create reusable custom elements — with their functionality encapsulated ...
Read more >
Development: Hot Module Replacement
Web component HMR works by replacing class references and instance prototype chains with proxies. Whenever a class or a property on the prototype...
Read more >
A Complete Introduction to Web Components in 2022 - Kinsta
Web Components are a standard way to create reusable and modular HTML elements without using a JavaScript framework.
Read more >
Is there any CSS hot reload solution for the Web components?
There is no out-of-box solution for HMR with Web Components in General. It really depends on how you are using Web Components.
Read more >
Hot Module Reload - FAST design system
To learn more about HMR for Web Components and to see how to setup HMR in your own FAST projects, please see the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found