Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Question] How to specify different formats for multiple exports?

Open
#973 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale

Research direction

The issue names no repository file or test, but includes package.json exports examples and the microbundle command. Start by reviewing the documented single-export and multiple-export examples; done means clarifying whether per-export format mappings are supported and documenting the applicable configuration or limitation.

Written by the indexing model from the issue text.

Description

question :grey_question:

I'm trying to setup microbundle to provide separate exports for several modules my package is exporting, like this:

{
  "name": "x",
  "type": "module",
  "version": "10.0",
  "author": "y",
  "license": "MIT",
  "devDependencies": {
    "microbundle": "^0.15.0",
    "np": "^7.6.1",
    "typescript": "^4.6.4"
  },
  "dependencies": {},
  "scripts": {
    "prepare": "microbundle ./src/one.ts ./src/two.ts"
  },
  "exports": {
    "one": "./dist/one.modern.js",
    "two": "./dist/two.modern.js"
  },
  "files": [
    "dist"
  ],
  "types": "dist/index.d.ts"
}

However, I don't know how to specify different export formats for each one of my exports.

The documentations provides either this example, which shows how to proceed when doing "single" exports:

"exports": {
  "require": "./dist/foo.cjs",
  "default": "./dist/foo.modern.js"
},

or this example, which shows an example of multiple exports, but in a single format:

"exports": {
  ".": "./dist/foo.modern.mjs",
  "./lite": "./dist/lite.modern.mjs",
  "./full": "./dist/full.modern.mjs"
},

How could I specify multiple formats like in the 1st example, while still specifying multiple named exports like in the 2nd example?

Dominant language
JavaScript
Stars
8.1k
Forks
358
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from developit/microbundle

All issues in developit/microbundle

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.