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

Browerify issue #1045

Closed
SlyryD opened this issue May 18, 2018 · 3 comments
Closed

Browerify issue #1045

SlyryD opened this issue May 18, 2018 · 3 comments

Comments

@SlyryD
Copy link
Contributor

SlyryD commented May 18, 2018

protobuf.js version: master (6.8.7 candidate)

An error occurs when creating a browserify bundle that has protobufjs as a dependency. To repro, unzip slyryd-test.zip, and run npm install and npm run browserify. Removing the following line in the protobuf.js package.json file fixes the issue:

"browser": "dist/protobuf.js",

Example error:

Error: Cannot find module '4' from 'C:\Users\slyryd\Test\slyryd-test\node_modules\protobufjs\dist'
    at C:\Users\slyryd\Test\slyryd-test\node_modules\browser-resolve\node_modules\resolve\lib\async.js:46:17
    at process (C:\Users\slyryd\Test\slyryd-test\node_modules\browser-resolve\node_modules\resolve\lib\async.js:173:43)
    at ondir (C:\Users\slyryd\Test\slyryd-test\node_modules\browser-resolve\node_modules\resolve\lib\async.js:188:17)
    at load (C:\Users\slyryd\Test\slyryd-test\node_modules\browser-resolve\node_modules\resolve\lib\async.js:69:43)
    at onex (C:\Users\slyryd\Test\slyryd-test\node_modules\browser-resolve\node_modules\resolve\lib\async.js:92:31)
    at C:\Users\slyryd\Test\slyryd-test\node_modules\browser-resolve\node_modules\resolve\lib\async.js:22:47
@SlyryD
Copy link
Contributor Author

SlyryD commented May 18, 2018

According to the package browser field spec, the entry point should be specified, rather than the bundle file.

Removing the line will make it look at index.js by default. If you wanted, there might also be some more complex logic you could use to specify src/index.js, src/index-light.js, and src/index-minimal.js.

@SlyryD
Copy link
Contributor Author

SlyryD commented May 18, 2018

I opened a pull request for this: #1046

@SlyryD
Copy link
Contributor Author

SlyryD commented May 20, 2018

Resolved

@SlyryD SlyryD closed this as completed May 20, 2018
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

No branches or pull requests

1 participant