-
-
Notifications
You must be signed in to change notification settings - Fork 703
Provided browser field in package.json #875
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
Conversation
Some tools use the browser field in the package.json to use an alternate main file. This is e.g. the case for rollup-plugin-node-resolve (https://github.com/rollup/rollup-plugin-node-resolve). Specs: https://github.com/defunctzombie/package-browser-field-spec#alternate-main---basic
LGTM! /cc @chaijs/chai |
Hello @bdadam, thanks for the PR! Personally, I prefer not to have bundled dist in the repo. It is extra file and extra commits. There are tools like https://wzrd.in/ for users that have no building process or js cdns. For those who do have, for example, Rollup or other modern tree-shaking stuff, Browserify bundle will add extra KBs to the package. |
Hello @shvaikalesh, thanks for your response. It is not about providing bundled dist files or not (it seems to be the case anyways, see: https://github.com/chaijs/chai/blob/master/chai.js). It is about which main file to use for builds for the browser. I have right now the case, that I would like to If the package.json includes the browser field, than that is preferred over the main entry by the rollup-plugin-node-resolve. Do you see any problem with using chai.js as the main entry? |
@bdadam Thanks for your PR! LGTM. |
@shvaikalesh we do make heavy use of the browserified bundle, for example it is used by all of the karma plugins. We could push it out into a different package, but thats probably out of scope for the PR. This is really a small change just to link it - shall we move the discussion of strategies for browser bundling to a separate issue? |
@keithamus Agreed, (not) having bundle in repo deserves a discussion in another issue. |
Thanks everyone for merging the PR. |
Some tools use the browser field in the package.json to use an alternate main file. This is e.g. the case for rollup-plugin-node-resolve (https://github.com/rollup/rollup-plugin-node-resolve).
Specs: https://github.com/defunctzombie/package-browser-field-spec#alternate-main---basic