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

[ENHANCEMENT] Publish package as standard JS modules #712

Open
1 task done
justinfagnani opened this issue May 8, 2024 · 1 comment
Open
1 task done

[ENHANCEMENT] Publish package as standard JS modules #712

justinfagnani opened this issue May 8, 2024 · 1 comment
Labels
Bug thing that needs fixing Needs Triage needs an initial review

Comments

@justinfagnani
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

This package is currently published as CommonJS modules only. This makes it impossible to use in browsers and other environments that don't support Common JS, without a build step.

Expected Behavior

This should just work with a suitable import map:

import semver from 'semver';

This could be done as part of a migration to standard JS modules only, or a dual-mode package, possibly as part of #498

Steps To Reproduce

  1. In a browser
  2. With dev server that can rewrite bare module specifiers to URLs (such as @web/dev-server with the --node-resolve flag)
  3. Load a module script with import semver from 'semver';
  4. See error...

Environment

  • npm:
  • Node:
  • OS:
  • platform: All browsers, Cloudflare Workers, more...
@justinfagnani justinfagnani added Bug thing that needs fixing Needs Triage needs an initial review labels May 8, 2024
@ljharb
Copy link

ljharb commented May 8, 2024

I’d hope an ESM-only migration is out of the question, since that would make semver unusable for the vast majority of ecosystem users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs an initial review
Projects
None yet
Development

No branches or pull requests

2 participants