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

type: 'module' or format: 'esm' should generate esm modules #1096

Open
whizzzkid opened this issue Oct 20, 2022 · 1 comment
Open

type: 'module' or format: 'esm' should generate esm modules #1096

whizzzkid opened this issue Oct 20, 2022 · 1 comment
Assignees
Labels
need/triage Needs initial labeling and prioritization

Comments

@whizzzkid
Copy link
Contributor

Right now the resulting dist/index.min.js does not provide named exports because the format is not set to esm. This happens because of padded umd banner and footer. The output should be esm which can then be imported for both the browser and node.

This can be achieved right now by setting package.json like so:

  ...
  "type": "module",
  ...
  "aegir": {
    "build": {
      "config": {
        "format": "esm",
        "banner": {
          "js": ""
        },
        "footer": {
          "js": ""
        }
      }
    }
  },
  ...

This should be selected by default if:

  1. package.json type is set to module
  2. build.config.format is esm
@lidel lidel added the need/triage Needs initial labeling and prioritization label Oct 21, 2022
@achingbrain
Copy link
Member

Typically node modules don't import the minified files, instead the ESM source or ESM transpiled from TS in dist.

Browser modules are typically bundled too so also import the ESM source/transpiled TS.

ESM should work as a minification option though.

Would you like to submit a PR that ensures there's no UMD wrapper when build.config.format is esm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

3 participants