-
-
Notifications
You must be signed in to change notification settings - Fork 190
Add package exports for browser and umd #146
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
Merged
brettz9
merged 1 commit into
JSONPath-Plus:master
from
gjvoosten:GH-145-fix-package-exports
Feb 5, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep this. It helps make explicit how the behavior works. See https://nodejs.org/api/packages.html for the standard that webpack and Rollup plugins are or ought to be (and likely will be if they aren't already) following.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but with
"type": "commonjs"
babel/webpack tell me:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... I've added a comment at webpack/webpack#11597 (comment) , as it looks to me that bundlers should not be using
type
for interpretation of non-Node fields. There is a workaround there that may work for now without our changing the code, as I really think we should be able to use ".js" with browser ESM while usingtype: commonjs
for Node. If we don't hear back in some time, let's file a new Webpack issue.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And when revisiting this, Node recommends using
default
overbrowser
(that probably makes sense too since other environments might support our own "vm" but not Node's).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If by that work-around you mean adding something like:
to my webpack config, then: no, that doesn't work. Webpack 5 still loads the node version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went ahead and filed webpack/webpack#12598 as I do recall you had this before. Will see about a response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given our earlier discussion of this, I wanted to let you know (and anyone watching this) that I am planning to release as a true ESM module by using
type: 'module'
(otherwise our default ".js" is not understood in some environments as being a genuine module, e.g., Mocha 9 fails completely, and I think it has only been working in modules up to now because ESM can import CJS as we provide).Would you mind testing out the
esm
branch?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brettz9 Where do I find this
esm
branch?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry, https://github.com/brettz9/JSONPath/tree/esm , i.e., cloning https://github.com/brettz9/JSONPath#esm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brettz9 Appears to work fine; apologies for the delay.