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: browser field should point to cjs #20

Merged
merged 1 commit into from
Apr 6, 2021

Conversation

achingbrain
Copy link
Collaborator

@achingbrain achingbrain commented Apr 6, 2021

a top-level "browser" field should point to CJS files that, when bundled by a non-broken module bundler, work in a browser

browserify/browser-resolve#101 (comment)

I've changed the browser field to point to the cjs version of this module in line with the above comment because this module is currently broken when used with browserify.

I've also added the util module as a dep since it's used in the code. It would be ignored in most environments so the only cost is a slightly larger bundle but it's likely to be included in any non-trivial bundle somewhere anyway so there's likely to be no real-world impact.

Also:

  • Adds typescript dep to tests that test typescript, otherwise tests fail with 'cannot determine executable to run' - unless you have tsc installed globally I guess?
  • Fixes a typo in a comment
  • Simplifies .gitignore

Fixes #19

> a top-level "browser" field should point to CJS files that, when bundled by a non-broken module bundler, work in a browser

browserify/browser-resolve#101 (comment)

I've changed the `browser` field to point to the `cjs` version of this module in
line with the above comment because this module is currently broken when used with
browserify.

I've also added the [util](https://www.npmjs.com/package/util) module as a dep since it's used
in the code. It would be ignored in most environments so the only cost is a slightly larger
bundle but it's likely to be included in any non-trivial bundle somewhere anyway so there's
likely to be no real-world impact.

Also:

- Adds typescript dep to tests that test typescript, otherwise tests fail with
  'cannot determine executable to run' - unless you have tsc installed globally I guess?
- Fixes a typo in a comment
- Simplifies .gitignore

Fixes #19
@hugomrdias hugomrdias merged commit 3992702 into default Apr 6, 2021
@hugomrdias hugomrdias deleted the fix/browser-field-should-point-to-cjs branch April 6, 2021 08:04
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.

Latest version is broken in browserify?
2 participants