-
Notifications
You must be signed in to change notification settings - Fork 26
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
Use tsdx to build without transpiling generators #120
Conversation
The preview packages of this pull request have been published. effectionInstall using the following command: $ npm install effection@try-rollup Or update your package.json file: {
"effection": "try-rollup"
} @effection/eventsInstall using the following command: $ npm install @effection/events@try-rollup Or update your package.json file: {
"@effection/events": "try-rollup"
} @effection/nodeInstall using the following command: $ npm install @effection/node@try-rollup Or update your package.json file: {
"@effection/node": "try-rollup"
} |
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.
Looks good. Weird that the type tests are failing because of a mocha issue. I wonder if there is some type declarations in the node_modules
directory that are getting included that weren't getting included before.
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.
Looks good to me. Should we try linking it against bigtest before merging? I'd be happy to help out with that.
@@ -1,4 +1,7 @@ | |||
{ | |||
"extends": "./tsconfig", | |||
"compilerOptions": { | |||
"module": "esnext" |
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.
What's the default in @frontside/tsconfig
or does it say?
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.
It defaults to module: "commonjs"
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.
It's a side discussion, but should it?
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.
not sure, probably not.
Motivation
We made a decision to ship generators in our distribution bundles because IE11 compatibility is not important to us. It's surprisingly difficult to get this to work. We tried using microbundle but that turned out to be even more complicated because their modern and cjs formats have mutually conflicting configuration.
Approach
I tried
tsdx
but it also transpiles generators by default. There is an RFC to make tsdx more customizable but in the mean time I patchedtsdx
to exclude@babel/plugin-transform-regenerator
from Babel plugins using patch-package.patch-package
onpostinstall
Learning
patch-package is pretty cool. It has a nice workflow. When you need to change a dependency, modify it's code in node_modules and run
npx patch-package <package_name>
. It'll compare a fresh copy of the package that you're modifying to your changed copy and created a diff. It'll automatically apply this diff when you runyarn
.