-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: sources.map is not a function #6
Comments
Hmmm interesting. Well, I'm expecting the modules to be bundled in a specific way (webpack_require.m to be the modules array). Maybe the case with multiple entry points makes the bundle to be slightly different ? @yemi, if you can show me the output of this build or even better, if you can point me to a github repo with subset of the code which causes this problem so I can fork and figure this out, it can be great ! Thanks |
@yemi Now I found the time to try and reproduce this issue. I couldn't. I added multiple entry points and checked if the sources is instance of Array in all of the outputs. It worked ok regardless the order in the entry object. Which plugins do you use ? |
Im just on my way out to the swedish booze shop, which is closed tomorrow because its a public holiday so you have to plan ahead if you wanna get anything at all (unless you settle for 3.5% alc). So sorry for the short answer (even if its not that short, but surely unnecessary long), but, it seems to have something to do with the |
I encountered with this problem as well and it's easy to reproduce.
And you got the error! |
@yemi not really. I was using the CommonChunks plugin without errors. @stupidisum I don't understand your instructions. how to combine it ? how do you call this lib ? I just need to understand how you are using this lib and I'll find the bug (unless there is |
@stupidisum please check #10. Is it fixes your issue ? |
I debugged into the source code. It looks like I wanted to use If I don't set |
It's a lib redbox the RRSK used recommend |
I changed |
@stupidisum I might have a clue but I'm not able to reproduce. Can you replace iterations over sources (here and here) with iterations over => ...
var keys = Object.keys(sources)
for (var i = 0, l = keys.length; i < l; i++) {
var key = keys[i];
if (!sources[key]) {
continue;
}
var wrapperFuncString = sources[key].toString();
...
...
...
keys.map(function (key) {
return sources[key].toString();
}).join(',')
... Did it fix it ? I don't know why and what is the reason but sometimes when using the CommonChunks plugin, the |
Actually, I tried, upon found it's an array-like object, to replace |
Did you try to use a |
I'm not using In addition to adding support for sources as object in 2 places (I noted in my code snippet), did you check #10 ? My guess is that it fixes the other issues you faced with |
I didn't get luck for this. Again. |
Although I'm using react-google-maps now, I'm still glad to figure out what's wrong with react-map-gl |
@stupidisum I don't really understand with what you didn't get luck. With this specific issue ( I tried to setup I think that the fix in version If you like to create a working repo which combines |
I'm closing this issue because I fixed the Feel free to reopen if this error appears again. |
First of all, thanks for a great lib, really saved me some stress about releasing a feature im working on.
So, i have a
webpack.config.js
with a few entry points, i tried to importwebworkify-webpack
in one of them (along with other imports) and use it for a heavily computational task, this didnt work by default (threw same error message as in title) so i tried adding another entry point to my webpack config that would only import this library just to see if it might work then, which it did.However, i found out after some time that it didnt have to do with whether i imported the lib or not, but with whether
sources
(https://github.com/borisirota/webworkify-webpack/blob/master/index.js#L2) is an array or not, and by adding this extra empty entry point,sources
became an array..I have no idea why that happens but maybe you have a clearer understanding of this?
Webpack config without empty test entrypoint:
Webpack config with empty test entrypoint:
The text was updated successfully, but these errors were encountered: