Open xc2 opened 2 days ago
Supposed to be a bug here https://github.com/web-infra-dev/rslib/blob/2e8b298c4bad888f3e923a1e17b5558944017dc5/packages/core/src/config.ts#L890. User's explicit relative import extension is in conflict with the real file extension.
If the template filename is too complicated to determine the js extension, I’d prefer an option like jsExtension: string | "auto"
We can add a redirect.extension
configuration to handle this scene which is in our plan.
Version
Details
Cannot even set output.filename.js when
autoExtension
isfalse
Setup
package.json of workspace
rslib.config.ts
Exepected
import xxx from './fooo.mjs'
in esm outputaaa_require('./fooo.cjs')
in cjs outputBut got
import xxx from './fooo.js'
in esm outputaaa_require('./fooo.js')
in cjs outputReproduce link
https://github.com/xc2/jbpr/blob/auto-extension-repro/sources/BUILD.ts
Reproduce Steps
ESM:
run
pnpm rslib build -- //sources:esm
and look intodist/lib
CJS:
run
pnpm rslib build -- //sources:cjs
and look intodist/lib