-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: use tsc output code in both cjs and esm formats #127
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Lxxyx for this PR! After looking at the build output of TSDX, I have two questions:
- is it possible to not bundle the output together? Bundling should be the responsibility of final application build, and having an unbundled output makes debugging easier for us.
- It currently outputs declaration files for each of our source files, allowing people to import
superjson/accessDeep
or smth. But since the javascript code for that is all in the bundles, that import will break. Is there a way to omit these per-file declaration maps / have them bundled together?
I tried to look them up in the TSDX docs, but couldn't find anything. Maybe you have an idea :D
Also: Do you think it'd be possible to add ESM support without using TSDX? One of the reasons I removed it in #97 is that it does a whole lot of things that I don't understand, and I didn't see the benefits for a small library like SuperJSON.
@Skn0tt We can do this. Use tsc to output code in both cjs and esm formats, and be forward compatible {
"scripts": {
"build": "npm run build:cjs && npm run build:esm",
"build:cjs": "tsc",
"build:esm": "tsc --module es2015 --outDir dist/esm"
},
"module": "dist/esm/index.js"
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do this. Use tsc to output code in both cjs and esm formats, and be forward compatible
That'd be great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks a lot for your work on this ❤️
Published in v1.7.3 |
@allcontributors add Lxxyx for code |
I've put up a pull request to add @Lxxyx! 🎉 |
Fixes: #126