Skip to content

fix: Don't load browserslist in block-hoist-plugin#13182

Merged
JLHwung merged 3 commits intobabel:mainfrom
MichaReiser:avoid-loading-browserslist-in-blockhoist-plugin
Apr 21, 2021
Merged

fix: Don't load browserslist in block-hoist-plugin#13182
JLHwung merged 3 commits intobabel:mainfrom
MichaReiser:avoid-loading-browserslist-in-blockhoist-plugin

Conversation

@MichaReiser
Copy link
Copy Markdown
Contributor

@MichaReiser MichaReiser commented Apr 20, 2021

Q                       A
Fixed Issues?
Patch: Bug Fix? 👍
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? No Tests as discussed
Documentation PR Link -
Any Dependency Changes?
License MIT

7.13.0 introduced the new option browserslistConfigFile in #12189. The documentation specifies that the option toggles whatever babel looks for a browserslists configuration or not.

Toggles whether or not browserslist config sources are used, which includes searching for any browserslist files or referencing the browserslist key inside package.json. This is useful for projects that use a browserslist config for files that won't be compiled with Babel.

This works fine, except that the block-hoist-plugin loads a configuration without setting the browserslistConfigFile to false.

The block-hoist-plugin should set the browserslistConfigFile to false to prevent babel from loading (or looking for) a browserslists config when users explicitly disabled this functionality. The block-hoist-plugin makes no use of the browserslist itself, which is why the change should be fine.

Comment thread packages/babel-core/test/api.js Outdated
@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci Bot commented Apr 20, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 0e11cca:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Apr 20, 2021

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/45489/

const config = loadConfig.sync({
babelrc: false,
configFile: false,
browserslistConfigFile: false,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually we can completely avoid loadConfig.sync. I drafted some perf changes before but never come up with a PR: JLHwung@15da88e

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That would even be better! It wasn't clear to me why it was needed so I tried to work around it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@JLHwung are you planning to submit your changes as a PR?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nope, feel free to tackle it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

seems good as temp fix then? didn't even know we had this..

@JLHwung JLHwung added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Apr 20, 2021
Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

The code changes look good.

If you have time to work on it I would prefer something like what @JLHwung proposed in #13182 (comment); otherwise we can merge this and then update it in the future.

@JLHwung JLHwung merged commit adb5ada into babel:main Apr 21, 2021
@github-actions github-actions Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jul 22, 2021
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants