Open fadilmamedov opened 5 years ago
Any updates on this?
Sorry, somehow I missed this.
From what I understand, I think this is an issue of Webpack. I feel Webpack caches the resolved path for a given import path and doesn't use the resolver to resolve the path again with HMR.
From what I understand, I think this is an issue of Webpack. I feel Webpack caches the resolved path for a given import path and doesn't use the resolver to resolve the path again with HMR.
Perhaps something as simple as delete require.cache[path]
.
Just an idea, we're not having the issue.
Thanks for the idea. Actual require
call is done by Webpack, this plugin only tells Webpack which file should be loaded for a given import/require. I didn't check the source code of Webpack but I suspect it probably is not using require
as Node interpret things as JavaScript, but Webpack supports loading all kinds of things.
Let's say I have a folder in
source
folder namedComponent
and two files inside it:index.js
andComponent.js
. Configuration looks like so:When I start Webpack everything works as expected,
index.js
file is loaded. But when I removeindex.js
file I expectComponent.js
to be loaded, but instead it still tries to loadindex.js
file. It works as expected if I restart Webpack though. But I want this to be working correctly with Webpack Dev Server and HMR.What am I doing wrong?