-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Object form of browser
in package.json
not supported
#6890
Comments
We do respect the "browser" field, but only when its value is a single string rather than an object containing multiple mappings, since the string case is much more common. See here for the relevant code. Another very common use of the "browser" field is to provide stubs for Node's built-in modules like I'm open to implementing full support for the "browser" field, though I will also mention two other possible solutions:
Supporting non-standard properties of |
Keccakjs maintainer has modified to work with Meteor. Thanks for the help both! |
WebTorrent uses the object version of the "browser" field, so this is broken in Meteor right now. See: https://github.com/feross/webtorrent/blob/master/package.json#L10-L19 |
+1 |
browser
field in package.json
not respected?browser
in package.json
not supported
Would be nice yes to implement the full browser field like webpack and browserify does: https://github.com/defunctzombie/package-browser-field-spec |
jsdom also uses the object version of the "browser" field |
Superagent https://github.com/visionmedia/superagent/blob/master/package.json#L53 and spotify-web-api-node https://github.com/thelinmichael/spotify-web-api-node/blob/master/package.json#L50 use the object version of browser field and are broken :/ |
+1 to get this fixed :) |
AWS SDK is broken too. https://github.com/aws/aws-sdk-js/blob/master/package.json#L49-L54 |
@ilya-pirogov I managed to get this working by first: Then in my case working with S3 wasn't a problem when imported this way: If you need to access the global AWS object then import it as: I'm not sure this will work in all circumstances, but it worked for me so far. |
@damonmaria Thank you! It really works. Tested with DynamoDB and SQS. |
Another one here :) https://github.com/mapbox/mapbox-gl-js/blob/master/package.json#L99, meteor bundles the file meant for node, and not the one meant for the browser, which breaks my app. Cheers! |
+1 for a fix. Affecting a lot of useful services:
Does anyone have a work-around I can use in the meantime? |
For portability, we are using graphql for backed communication and avoided using meteor specific calls. The best work around we found was to ditch meteor all together. It made things much easier in the long run and allowed us to use serverless architecture. |
Hmmm.. I know Meteor well enough that it would kill speed for now.
But I think I am absolutely going to push out a prototype/MVP and do
something similar...
Cheers for the input!
…On Thu, Sep 21, 2017 at 5:05 PM, Robert Van Gorkom ***@***.*** > wrote:
For portability, we are using graphql for backed communication and avoided
using meteor specific calls. The best work around we found was to ditch
meteor all together. It made things much easier in the long run and allowed
us to use serverless architecture.
To transition, we built our own client code and used meteor for the backed
only. After a bit of that, porting to lambda was pretty straight forward.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6890 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AO6Pf5xQ5MooXv6dYnecD-VZZz5zH5xgks5skibOgaJpZM4IOcAR>
.
|
I ran into this trying out
@benjamn I can look into solving this if you give me a clue of where to start EDIT: Seems like maybe as simple as updating this line? https://github.com/benjamn/install/blob/master/install.js#L500 |
As with many module resolution features, implementing this functionality requires cooperation between static bundling logic (the This functionality would be much simpler to implement if the Unfortunately, the How does this feature work in Webpack and Browserify? Those bundlers statically rewrite all imported module identifiers as numbers, which means Meteor's module system guarantees any Long story short, I think the relative style of How do folks feel about that? Is it worth supporting the relative style if we don't support the package style? Is that better than the status quo, at least? |
Supporting 80% of the browser field is better than 50%, surely (percentages selected are arbitrary, obviously) |
As long as it covers more bases than it does now it has to be an improvement. I've struck this issue in Meteor a couple of times (AWS and Algolia packages) and both only use the "relative style". |
@benjamn Thanks as usual for helping us understand the complexities. I agree that supporting the relative style is the primary request here. It seems to be far more common. Would the complexities preclude supporting the If it helps, this is as far as I got looking at browserify implementation before I got pulled into other tasks. :) https://github.com/defunctzombie/node-browser-resolve/blob/master/index.js#L153-L176 |
The |
PR #9311 addresses this issue (by supporting the "relative style" of browser replacements), and has been merged. This should be coming in 1.6.1. Thanks all! |
@benjamn I am also having still the error that KayleePop mentioned. Any insights? Seems the object field is still not supported? Any thoughts? |
@luchux My insights are richly detailed in the comments above. |
The latest MobX version uses an object-form of browser in package.json, which Meteor cannot deal with: mobxjs/mobx#1844 |
_1 Upvote_
Meteor 1.3.2.4
There appears to be some broken behaviour when installing npm packages that use a
browser
field inpackage.json
to specify browserify-compatible code.package.json
in question:Report copied from: axic/keccakjs#1:
Seems like Meteor 1.3 ES6 import is having issues with this package, and is affecting other packages depending on
keccakjs
.Reproduction:
client/main.js
(same outcome with
require
)Errors:
node console
browser console
Related:
Seems like it's not respecting the
browser
field inpackage.json
. Hard-coding the browserified package 'fixes' the problem.The text was updated successfully, but these errors were encountered: