-
Notifications
You must be signed in to change notification settings - Fork 361
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
Split up wasm loading based on compilation target. #363
Conversation
Pull Request Test Coverage Report for Build 530
💛 - Coveralls |
5c2ab93
to
440d984
Compare
This seems better to me as well. I tend to think it should land after the patch to remove |
Yup, I just posted everything I had in mind for now, but agreed that landing it after |
440d984
to
13f296a
Compare
I can't figure out how to use this package in a browser. I'm using webpack with I get the error the second I import the package, so it's not even reaching the code where I set the url. import sourceMap from 'source-map';
sourceMap.SourceMapConsumer.initialize({
"lib/mappings.wasm": "xxx/mappings.wasm"
}); |
@AdrianMrn Have you potentially overridden the default Line 53 in 7adff2c
browser as a mainFields value that would explain the issue.
|
Excuse the necro. I just picked this back up and managed to fix my issue. It seems that, when I pulled in the package through npm, it didn't get me the latest version that has the line you mentioned, because it's a beta release. I had to manually set my version of |
I encountered the same issue as AdrianMrn stated, then found I was using 0.7.4. Since 0.8.0-beta.0 has been released for 4 years without updates, is it possible to merge this commit into 0.7.x? |
Per my comment in #350 (comment), this feels like a more ideal way to approach this. This leaves it up to bundlers to swap out the files when bundling for browser use.
I'm personally a fan of this approach because it's also an easily-reproducible check. As it is, there's no way for a module making use of
source-map
to know whether a call toSourceMapConsumer.initialize
is needed, or will result in aconsole.debug("SourceMapConsumer.initialize is a no-op when running in node.js");
message. This gives one central toggle for that, which they can also use in their own code when deciding whether to call.initialize
or not.