tsc-multi utility were chosen to conduct compilation for different targets.
It does 2 important things that had to be done anyway (manually or by another script):
Renames output file extensions to .cjs/.mjs (CommonJS/ESM accordingly);
Alternative is to echo {"type":"commonjs"} > package.json into folder with CJS builds
and echo {"type":"module"} > package.json into folder with ESM builds.
ESM builds: appends .(m)js to relative imports in order to comply with ES modules loading guidelines.
Alternative is to replace all relative imports within output files manually using regex or hardcode .(m)js extensions in relative imports in source files.
Fixes #125.
tsc-multi utility were chosen to conduct compilation for different targets. It does 2 important things that had to be done anyway (manually or by another script):
.cjs
/.mjs
(CommonJS/ESM accordingly); Alternative is toecho {"type":"commonjs"} > package.json
into folder with CJS builds andecho {"type":"module"} > package.json
into folder with ESM builds..(m)js
to relative imports in order to comply with ES modules loading guidelines. Alternative is to replace all relative imports within output files manually using regex or hardcode.(m)js
extensions in relative imports in source files.