-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix package browser field descriptor #1046
Conversation
I verified I was able to produce a browserify bundle with each of the three libraries as a dependency, producing 3 bundles of differing lengths as expected. |
package.json
Outdated
@@ -18,7 +18,11 @@ | |||
"typescript" | |||
], | |||
"main": "index.js", | |||
"browser": "dist/protobuf.js", | |||
"browser": { | |||
"protobufjs": "./index.js", |
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.
Are these aliases actually necessary? From my understanding, as the library is imported from the outside already, having them on the inside shouldn't do anything? For example, there is a light.js
at the root of the package already that is picked up on require("protobufjs/light")
.
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.
Removing the browser entry works, and specifying all three works. Specifying only index.js does not work.
package.json
Outdated
"protobufjs/light": "./light.js", | ||
"protobufjs/minimal": "./minimal.js" | ||
}, | ||
"browser": "index.js", |
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 think the browser entry can simply be removed (and it should still pick up main
). As you pointed out, previous usage in the package.json was essentially wrong.
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.
Agreed, I will do that. Thanks!
Thanks :) |
Hi @dcodeIO , is there anything else delaying the release of npm package v6.8.7? Thanks! |
The package browser field descriptor expects an entry point, rather than the bundle file path.
This change specifies an entry point for the three different libraries.
Addresses issue #1045