Closed make-github-pseudonymous-again closed 2 years ago
Cheers, thanks for spotting and reporting. I see the issue, but it seems we have a bit of a blind spot in the test suite for this so I'm trying to rectify that.
You will probably want to migrate to "exports"
anyhow (and looking at the linked repo, it seems you have) as "esmodule"
never got a ton of support AFAICT.
I'll try migrating to "exports"
. Thanks @rschristian!
I tried using exports
with the exact same filenames but it still wants to add .modern
before .js
:
$ npm-run-all --parallel build:*
$ microbundle --cwd packages/api --target web --format modern,cjs && cp -l packages/api/dist/api/src/mod.d.ts packages/api/dist/mod.d.ts
$ microbundle --cwd packages/cli --target node --format modern
Build "cli" to dist:
6.28 kB: main.modern.js.gz
5.57 kB: main.modern.js.br
Build "api" to dist:
1.81 kB: mod.cjs.gz
1.6 kB: mod.cjs.br
1140 B: mod.modern.js.gz
978 B: mod.modern.js.br
I guess I could just use mod.modern.js
to make it work, but is this expected?
Yes, sorry, "exports"
also will be affected by that.
The advice to migrate was more in the general sense, rather than a workaround to this issue; little out there consumes "esmodule"
, so it's just a dead entry in most situations.
Edit: Also no reason to use .cjs
& .mjs
at the same time. Your package is "type": "module"
, so can just use .js
for the modern output.
OK!
Also no reason to use .cjs & .mjs at the same time. Your package is "type": "module", so can just use .js for the modern output.
I think I just wanted to avoid any chance of the running environment wrongly "guessing" the file format. But I guess no environment exists that understands .mjs
but not the "type"
key.
Here is what I get when running
v14.2.0
:Here is what I get with
v15.0.0
:These are the config files for
api
andcli
Sources can be found here.