Skip to content
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

chore: refactor runPluginOverrides #130

Merged
merged 1 commit into from
Mar 30, 2023

Conversation

ArnaudBarre
Copy link
Member

The nested callback and the boolean returns confused me.
I prefer to have the run callback optional and use an iife for setup the babelPlugins so I this doesn't need a temporary let and there is one less branch

Comment on lines +219 to +192
const newBabelOptions = createBabelOptions(
typeof opts.babel === 'function'
? opts.babel(id, { ssr })
: opts.babel,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We lost an optimization here, if opts.babel isn't a function, createBabelOptions can be created upfront and cached.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept it when there is not plugin overrides.
When there are one, I think it's safer to re-create one because it mutates the object

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see 👍🏼

@ArnaudBarre ArnaudBarre force-pushed the chore/refactor-plugin-overrides branch from d1bdd05 to 8b116bc Compare March 30, 2023 09:12
@ArnaudBarre ArnaudBarre merged commit 2a3b026 into main Mar 30, 2023
@ArnaudBarre ArnaudBarre deleted the chore/refactor-plugin-overrides branch March 30, 2023 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants