Closed ExE-Boss closed 4 years ago
ping 😄
Symbolic links don't work since the final resolved path is considered. Also you can't publish symbolic links on npm.
A solution might be to add a prepare step that copies tslib.es6.js to tslib.mjs and the have the conditional export for import point to the .mjs file. I can create a PR if that's acceptable.
A better option is to just do a ./tslib.js → ./tslib.cjs
and ./tslib → ./tslib.cjs
exports path mapping: https://github.com/microsoft/tslib/blob/71887cc57cb4c775f60ebbb25720724189f04766/package.json#L35-L36
Changing the file extension from .js to .cjs is still a breaking change since conditional exports are used only by node and not other tools(and older node).
That’s why I wanted to get this into v2.0.
Ok - I shouldn't say breaking change. This change could break the usage of tslib with bundlers and other tools because of the .cjs file extension. Using .mjs for the conditional export would be a safer change.
Changing file names etc might be considered a breaking change? https://github.com/microsoft/tslib/pull/121 would be fully backwards compatible I believe.
Thanks - ES Module support was shipped with #126
I’ve also added
exports
mappings fortslib/tslib.js
→tslib/tslib.cjs
.Supersedes and closes #44
Resolves #81; closes #84