solidjs / solid-refresh

MIT License
86 stars 18 forks source link

Troubleshooting steps to make HMR work in complex webpack configs #68

Open non25 opened 5 months ago

non25 commented 5 months ago

Hello!

I've spent some time figuring out why it didn't work for me in webpack 5.

And it appears that you need to force webpack to use development export condition.

The simpler way to do this is to use resolve.conditionNames.

The complicated way to do this, which I used initially is to force paths with aliases:

alias: {
  'solid-js$': require.resolve(`solid-js/dist/${prod ? 'solid' : 'dev'}.js`),
  'solid-js/web$': require.resolve(`solid-js/web/dist/${prod ? 'solid' : 'dev'}.js`),
  'solid-js/store$': require.resolve(`solid-js/store/dist/${prod ? 'solid' : 'dev'}.js`),
}

So here's slight readme adjustment to hint that to avoid some confused head-scatching for someone else. :sweat_smile:

Thanks for the plugin! Works real good. :grin: Even render-props work, wow. :tada: