Closed davidmurdoch closed 11 months ago
Nevermind, adding if (!depModule.resourceResolveData) continue;
just causes:
Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
Hallo @davidmurdoch,
thanks for the issue report.
Can you please create small repo with the reproducible issue. The TODO was noticed to find a use case where the object can be undefined. You have this use case detected.
@davidmurdoch
can you please share your use case. I need it to write the test for this issue.
I'll try to get something together next week.
I think my problem was that my webpack file had resolve.extensions = ['.scss', '.ts', '.js'];
and my code had both index.js
and index.scss
in the same directory. The code base is very large and there are lots of moving pieces so it's hard to pinpoint exactly what made it work.
the resolve.extensions = ['.scss', '.ts', '.js']
is a wrong config, you should auto resolve only .js
, .ts
files, but not .scss
.
If you use resolve.extensions = ['.ts', '.js']
only does the error occur?
Yeah, sorry I wasn't clear. Removing .scss
from resolve.extensions
seems to have been the fix for this, as well as some other import issues I was having.
My hunch was that multiple files with the same name, but different extensions (that webpack will resolve), causes some condition that causes a circular walk
in this plugin. I suspect a ts file and a js file with the same name will cause the issue as well, but I haven't tried creating a minimal reproduction.
@davidmurdoch
the error: Cannot read properties of undefined (reading '_bundlerPluginMeta')
is fixed in the ver 3.4.2
.
Can be the issue closed? The solution for the circular walk was not using style extensions in the resolve.extensions
.
Can be the issue closed? The solution for the circular walk was not using style extensions in the resolve.extensions.
I don't mind if you close it. But I do think this case should be handled somehow, maybe even just with some documentation about how to do things correctly, like you have for splitChunks
(thank you for that! it was so helpful!).
@davidmurdoch
I have added in the readme the new section Automatic resolving of file extensions under Problems & Solutions.
You can correct and supplement the text. Any PR is welcome!
Perfect! You're a really great FOSS maintainer. Thanks once again!
Perfect! You're a really great FOSS maintainer. Thanks once again!
If you think this plugin could be useful to other developers, perhaps you can (but not must) promote it (just GitHub link) on your Twitter and/or Reddit ;-)
https://github.com/webdiscus/html-bundler-webpack-plugin/blob/d278fced2903c68dbebd7de8c76907baea621d8c/src/Plugin/Collection.js#L536
I think the fix might be to check if
depModule.resourceResolveData
is defined before continuing to walk the dependencies.p.s., The
// TODO: test
existing on the same line as the failing code made me smile a little :-)