Open justin-schroeder opened 3 years ago
FWIW — TSDX is an awesome project, was really helpful in bootstrapping a new typescript project. It's helpful to have an opinionated approach like this. The project I'm working on is trying to shave every byte out it can so this issue was a bit of a showstopper for me — in the meantime i've moved to straight tsc
compilation with a custom terser
implementation to shave a few extra bytes off.
You can create a babel config file, and specify true
to targets.esmodules
option.
I found out this can be done by adding the following .browserslistrc
file in your project root:
last 2 Chrome versions
last 2 Firefox versions
last 2 Safari versions
node 12
It can’t be too new, because tsdx uses an older version of terser which doesn’t understand some syntax (such as optional?.chaining)
Current Behavior
When creating a new library that needs no legacy support (ES6+ is just 👌) — I seem unable to produce esm outputs that are not transpiled to ES5. Reproduction:
target: 'ES2015
tocompileOptions
intsconfig.js
:index.ts
:yarn build
Check the
dist/es-6-module.esm.js
output:export { logSecond };