Closed Jack-Works closed 4 years ago
@crimx hi did you try this?
Hi sorry for the delay. I'll take the time to test it later today.
I've integrated the hmr example into the project. Please pull and take a look.
Does it work well? If so, I'm happy with that
It works well. Thanks for the PR.
Published.
I have another question. Now we require users to manually change their webpack config, is it possible to modify the config in the plugin?
I think this belongs to another layer. In webpack source the default config is modified somewhere else base on the target name.
close #3
Please try it with this config:
console.log(log()) if (module.hot) { module.hot.accept('./shared', (nextMod) => { console.log(log()) }) }
const ele = document.createElement('h1') document.body.appendChild(ele) ele.innerText = log()
module.hot.accept('./shared', () => { ele.innerText = log() })
Then run
npm run start
and change src/shared.js to see how HMR works.