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

Fix package browser field descriptor #1046

Merged
merged 5 commits into from
May 19, 2018
Merged

Fix package browser field descriptor #1046

merged 5 commits into from
May 19, 2018

Conversation

SlyryD
Copy link
Contributor

@SlyryD SlyryD commented May 18, 2018

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

@SlyryD SlyryD closed this May 18, 2018
@SlyryD SlyryD reopened this May 18, 2018
@SlyryD SlyryD closed this May 18, 2018
@SlyryD SlyryD reopened this May 18, 2018
@SlyryD SlyryD mentioned this pull request May 18, 2018
@SlyryD
Copy link
Contributor Author

SlyryD commented May 18, 2018

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",
Copy link
Member

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").

Copy link
Contributor Author

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",
Copy link
Member

@dcodeIO dcodeIO May 18, 2018

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.

Copy link
Contributor Author

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!

@dcodeIO dcodeIO merged commit e8449c4 into protobufjs:master May 19, 2018
@dcodeIO
Copy link
Member

dcodeIO commented May 19, 2018

Thanks :)

@SlyryD SlyryD deleted the test branch May 21, 2018 17:12
@SlyryD
Copy link
Contributor Author

SlyryD commented May 21, 2018

Hi @dcodeIO , is there anything else delaying the release of npm package v6.8.7? Thanks!

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.

3 participants