-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat: allow to opt-out of default babel plugins and presets #41
Conversation
a1fd26f
to
db45d32
Compare
Great! I'm for it too. This was causing problems in the past and in the TSDX try of integrating this plugin. |
db45d32
to
08b3571
Compare
Hey there. Thanks for your contribution! Yes, I've been thinking along the same lines. So let's get the ball rolling on merging this PR 🙂. One thought that I have is this: The plugin does some magic to separate minification-related plugins/presets (such as Also, there are some pitfalls that are easy to get into that I really, really want to help users avoid. Things like duplicating babel helpers many times across chunks, or the I still think its valuable to enforce these options, even if I'm thinking along the lines of the following:
How do you feel about that? |
08b3571
to
801fbd7
Compare
separate minification-related plugins/presetsincluded in updated PR This is done using As we do not know which plugins may get loaded for a filename
|
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.
I added a few comments :-)
package.json
Outdated
"@babel/plugin-proposal-async-generator-functions": "^7.2.0", | ||
"@babel/plugin-proposal-json-strings": "^7.2.0", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.6.2", | ||
"@babel/plugin-proposal-optional-catch-binding": "^7.2.0", | ||
"@babel/plugin-proposal-unicode-property-regex": "^7.6.2", | ||
"@babel/plugin-syntax-dynamic-import": "^7.2.0", |
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 turns out that @babel/preset-env already depends on all of the proposal-* plugins that rollup-plugin-ts depends on, so we can leave all of these out.
package.json
Outdated
"@babel/plugin-proposal-async-generator-functions": { | ||
"optional": true | ||
}, | ||
"@babel/plugin-proposal-json-strings": { | ||
"optional": true | ||
}, | ||
"@babel/plugin-proposal-object-rest-spread": { | ||
"optional": true | ||
}, | ||
"@babel/plugin-proposal-optional-catch-binding": { | ||
"optional": true | ||
}, | ||
"@babel/plugin-proposal-unicode-property-regex": { | ||
"optional": true | ||
}, | ||
"@babel/plugin-syntax-dynamic-import": { | ||
"optional": true | ||
}, |
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 turns out that @babel/preset-env already depends on all of the proposal-* plugins that rollup-plugin-ts depends on, so we can leave these out.
Yes, agreed. Basically, it's not so much minification vs not, but rather "what should run per-file" vs "what should run per chunk". Mangling, for example, is definitely better per chunk than per file. So, for starters, I think it makes sense to stop calling it minifyOptions and start calling it I agree with you on the syntax-plugins-plus-whatever-was-excluded-during-transform point.
Sounds great!
Yes, due to the reasons outlined here and like known from other plugins like this, I very strongly believe it is a responsibility of this plugin to avoid helper functions being duplicated. That is the very reason for depending on We may end up doing something like that, but for now, my suggestion is to keep forcing the plugin, like we do with
Originally my concern was that it would be one hell of a
But, it turns out that |
b308d53
to
bc1e04d
Compare
Sorry for the delay. I pushed a commit to remove the additional plugins. This is my plan:
I hope i can get something done by thursday. |
6ed57cc
to
7032f08
Compare
separate minification-related plugins/presetsincluded in updated PR
Move ´@babel/preset-env
|
- transform: no minification plugins/presets - chunk: only minification and syntax plugins/presets
…y defined options
7032f08
to
2464c56
Compare
I rebased to PR and removed @wessberg Is there anything i can to do to get this PR merged? |
Great work. I'm testing out your PR, but I'm running into a crash: First, in the function
Sometimes, the function is called with not an ID, but a Currently on master, it takes a
It would seem that there's some normalization that needs to happen there. |
Sorry for the delay. I tested only the new config. Thanks for the detailed report. Now it should work. |
Hey there. Sorry for the very late response, but the code base has diverged significantly since this PR was originally created. However, the good news is that the general ideas behind this PR has been integrated with
Because of this, I'm closing this PR. Thanks for your great work. |
The unique feature of generating typescript declaration files for all chunks is really great and we want (need) to use this plugin.
But: we are using a own preset that internally configures
@babel/preset-env
. This can not be detected byrollup-plugin-ts
. This PR introduces an optionnoBabelConfigCustomization
to completly disable the default presets and plugins (which are a great feature!). This is opt-in or opt-out depending on the view ;-)I hope this can be merged and happy to adjust this PR.