Skip to content

Fix package browser field descriptor#1046

Merged
dcodeIO merged 5 commits intoprotobufjs:masterfrom
SlyryD:test
May 19, 2018
Merged

Fix package browser field descriptor#1046
dcodeIO merged 5 commits intoprotobufjs:masterfrom
SlyryD:test

Conversation

@SlyryD
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread package.json Outdated
"main": "index.js",
"browser": "dist/protobuf.js",
"browser": {
"protobufjs": "./index.js",
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread package.json Outdated
"protobufjs/light": "./light.js",
"protobufjs/minimal": "./minimal.js"
},
"browser": "index.js",
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

dcodeIO commented May 19, 2018

Thanks :)

@SlyryD SlyryD deleted the test branch May 21, 2018 17:12
@SlyryD
Copy link
Copy Markdown
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