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

Add extension to package.json:main #20

Open
betamos opened this issue Mar 17, 2020 · 1 comment
Open

Add extension to package.json:main #20

betamos opened this issue Mar 17, 2020 · 1 comment

Comments

@betamos
Copy link

betamos commented Mar 17, 2020

I'm seeing breakages with Webpack, and several other issues and forks seem to indicate issues with bundlers.

My understanding, which is shallow, is that at one point it was recommended to use extension-less main. It seem that now the recommendation is to use main with an extension, and that should probably be the js file, for compatibility.

As for the ES modules etc, there are now conditional exports through the exports field.

@ptpaterson
Copy link

I had issues using this package with create-react-app and webpack 5. One solution I found was to add this to package.json

  "exports": {
    ".": {
      "import": "./dist/abort-controller.mjs",
      "require": "./dist/abort-controller.js",
      "default": "./dist/abort-controller.js"
    },
    "./polyfill": {
      "import": "./polyfill.mjs",
      "require": "./polyfill.js",
      "default": "./polyfill.js"
    }
  },

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

2 participants