developit / developit/microbundle

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

オープン
#973 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る
question :grey_question:
主要言語
JavaScript
スター
8.1k
フォーク
358
PR マージ指標
30日以内にマージされた PR はありません

説明

I'm trying to setup `microbundle` to provide separate exports for several modules my package is exporting, like this:
```json
{
"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:
```json
"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:
```json
"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?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。