Default export not output as expected -- missing __esModule
See original GitHub issueCurrent Behavior
TSDX doesn’t seem to have the expected output when building a package with a default export. The type definitions are output as expected, but the resulting .js
file actually exports as { default: /* value */ }
. I’ve created a minimal, reproducible example at rtbenfield/tsdx-default-export bootstrapped from tsdx create
. This is my first time using TSDX and it is possible I am just doing something incorrectly.
In the repo mentioned above, I changed the sum
function to be a default export, then added output.test.ts
which imports directly from dist
instead of src
. output.test.ts
logs the value of import sum from "../dist"
and is showing sum
to be { default: ... }
instead of the actual function.
Expected behavior
The .js
output files in dist
can be consumed as default exports (ex. import sum from "my-module"
) if the source file utilized default exports.
Suggested solution(s)
Unsure, but willing to investigate if this is confirmed to be an issue. I know Webpack, but not Rollup, so it could be a good excuse for me to get some experience with it.
Additional context
Nothing relevant that I know of.
Your environment
Software | Version(s) |
---|---|
TSDX | 0.7.2 |
TypeScript | 3.5.2 |
Browser | N/A |
npm/Yarn | 6.9.0 / 1.16.0 |
Operating System | Windows 10 Pro 1903 |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:9
- Comments:16 (3 by maintainers)
Top GitHub Comments
Or just don’t use this devil syntax. Named exports do the work better.
Ran into this issue today. It’s not that I (and some others) want to use Default Export but because some other tools require Default Export to work, namely Mocha Custom Reporter.