Skip to content
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

Isomorphic imports 2 #27

Merged
merged 10 commits into from
Dec 13, 2016
Merged

Isomorphic imports 2 #27

merged 10 commits into from
Dec 13, 2016

Conversation

noahehall
Copy link

@noahehall noahehall commented Dec 10, 2016

specify main and browser fields in package.json

https://github.com/defunctzombie/package-browser-field-spec/blob/master/README.md

main exports function that returns undefined
browser exports idb

alternative to this pull request: #18
and fixes this issue: #17

You can test in this project:
https://github.com/noahehall/react-f-your-starterkit

$ npm install
$ npm run dev > test on 127.0.0.1:3000
$ npm run prod > test on https://localhost:3000

@@ -0,0 +1,5 @@
module.exports = {
idb: function () {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idb is a function here, but in the browser version it's an object with two methods.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updating

@jakearchibald
Copy link
Owner

This looks good to me! Going to bump the main version for this in case it breaks things with particular importers.

@jakearchibald jakearchibald merged commit 824f1b1 into jakearchibald:master Dec 13, 2016
@KeithHenry KeithHenry mentioned this pull request Mar 3, 2017
@KeithHenry
Copy link
Contributor

This has caused #33 - not all node.js environments should reject idb - Electron, Atom and anything else with access to a browser window should have a specific check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants