Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Sep 25, 2024

Q                       A
Fixed Issues? Fixes babel/babel-loader#690
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

In this PR we pass the browserslist config to the preset API addExternalDependency, so that it can be recognized by other build tools. To do so we call the browserslist.findConfigFile API available on 4.24.0.

@JLHwung JLHwung added the PR: Polish 💅 A type of pull request used for our changelog categories label Sep 25, 2024
@babel-bot
Copy link
Collaborator

babel-bot commented Sep 25, 2024

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

Copy link
Member

@liuxingbaoyu liuxingbaoyu left a comment

Choose a reason for hiding this comment

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

Let's add a test?


it.todo(
"should add .browserslistrc to external dependencies when browserslistConfigFile is specified",
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This case is not yet supported because babel-core resolves the browserslist config in loadPartialConfig phase, prior to the loadFullConfig phase where externalDependencies are prepared.

Copy link
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.

I'd mark this as Internal or Bug Fix.

@JLHwung JLHwung added PR: Internal 🏠 A type of pull request used for our changelog categories and removed PR: Polish 💅 A type of pull request used for our changelog categories labels Sep 26, 2024
@JLHwung JLHwung merged commit 367ab6c into babel:main Sep 26, 2024
56 checks passed
@JLHwung JLHwung deleted the add-browserslist-config-to-dependency branch September 26, 2024 16:31
zemnmez-renovate-bot added a commit to zemn-me/monorepo that referenced this pull request Oct 2, 2024
##### [`v7.25.7](https://github.com/babel/babel/blob/HEAD/CHANGELOG.md#v7257-2024-10-02)

##### 🐛 Bug Fix

-   `babel-helper-validator-identifier`
    -   [#16825](babel/babel#16825) fix: update identifier to unicode 16 ([@JLHwung](https://github.com/JLHwung))
-   `babel-traverse`
    -   [#16814](babel/babel#16814) fix: issue with node path keys updated on unrelated paths ([@DylanPiercey](https://github.com/DylanPiercey))
-   `babel-plugin-transform-classes`
    -   [#16797](babel/babel#16797) Use an inclusion rather than exclusion list for `super()` check ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-generator`
    -   [#16788](babel/babel#16788) Fix printing of TS `infer` in compact mode ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
    -   [#16785](babel/babel#16785) Print TS type annotations for destructuring in assignment pattern ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
    -   [#16778](babel/babel#16778) Respect `[no LineTerminator here]` after nodes ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))

##### 💅 Polish

-   `babel-types`
    -   [#16852](babel/babel#16852) Add deprecated JSDOC for fields ([@liuxingbaoyu](https://github.com/liuxingbaoyu))

##### 🏠 Internal

-   `babel-core`
    -   [#16820](babel/babel#16820) Allow sync loading of ESM when `--experimental-require-module` ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-helper-compilation-targets`, `babel-helper-plugin-utils`, `babel-preset-env`
    -   [#16858](babel/babel#16858) Add browserslist config to external dependency ([@JLHwung](https://github.com/JLHwung))
-   `babel-plugin-proposal-destructuring-private`, `babel-plugin-syntax-decimal`, `babel-plugin-syntax-import-reflection`, `babel-standalone`
    -   [#16809](babel/babel#16809) Archive syntax-import-reflection and syntax-decimal ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-generator`
    -   [#16779](babel/babel#16779) Simplify logic for `[no LineTerminator here]` before nodes ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))

##### 🏃‍♀️ Performance

-   `babel-plugin-transform-typescript`
    -   [#16875](babel/babel#16875) perf: Avoid extra cloning of namespaces ([@liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-types`
    -   [#16842](babel/babel#16842) perf: Improve [@babel/types](https://github.com/babel/types) builders ([@liuxingbaoyu](https://github.com/liuxingbaoyu))
    -   [#16828](babel/babel#16828) Only access `BABEL_TYPES_8_BREAKING` at startup ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
github-merge-queue bot pushed a commit to zemn-me/monorepo that referenced this pull request Oct 2, 2024
##### [`v7.25.7](https://github.com/babel/babel/blob/HEAD/CHANGELOG.md#v7257-2024-10-02)

##### 🐛 Bug Fix

-   `babel-helper-validator-identifier`
    -   [#16825](babel/babel#16825) fix: update identifier to unicode 16 ([@JLHwung](https://github.com/JLHwung))
-   `babel-traverse`
    -   [#16814](babel/babel#16814) fix: issue with node path keys updated on unrelated paths ([@DylanPiercey](https://github.com/DylanPiercey))
-   `babel-plugin-transform-classes`
    -   [#16797](babel/babel#16797) Use an inclusion rather than exclusion list for `super()` check ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-generator`
    -   [#16788](babel/babel#16788) Fix printing of TS `infer` in compact mode ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
    -   [#16785](babel/babel#16785) Print TS type annotations for destructuring in assignment pattern ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
    -   [#16778](babel/babel#16778) Respect `[no LineTerminator here]` after nodes ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))

##### 💅 Polish

-   `babel-types`
    -   [#16852](babel/babel#16852) Add deprecated JSDOC for fields ([@liuxingbaoyu](https://github.com/liuxingbaoyu))

##### 🏠 Internal

-   `babel-core`
    -   [#16820](babel/babel#16820) Allow sync loading of ESM when `--experimental-require-module` ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-helper-compilation-targets`, `babel-helper-plugin-utils`, `babel-preset-env`
    -   [#16858](babel/babel#16858) Add browserslist config to external dependency ([@JLHwung](https://github.com/JLHwung))
-   `babel-plugin-proposal-destructuring-private`, `babel-plugin-syntax-decimal`, `babel-plugin-syntax-import-reflection`, `babel-standalone`
    -   [#16809](babel/babel#16809) Archive syntax-import-reflection and syntax-decimal ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-generator`
    -   [#16779](babel/babel#16779) Simplify logic for `[no LineTerminator here]` before nodes ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))

##### 🏃‍♀️ Performance

-   `babel-plugin-transform-typescript`
    -   [#16875](babel/babel#16875) perf: Avoid extra cloning of namespaces ([@liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-types`
    -   [#16842](babel/babel#16842) perf: Improve [@babel/types](https://github.com/babel/types) builders ([@liuxingbaoyu](https://github.com/liuxingbaoyu))
    -   [#16828](babel/babel#16828) Only access `BABEL_TYPES_8_BREAKING` at startup ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
@isemanjski
Copy link

Hi, it seems that this change broke the resolution of browsers from BROWSERSLIST environment variable. Because you are now conditionally calling browserslist.loadConfig only if configFile exists. But there is a case when someone might not use any config file option but only the env variable. In loadConfig method the first that browserslist library does is to return the value of process.env.BROWSERSLIST if it's defined, otherwise, it proceeds with resolving other types of configurations.

@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 Jan 20, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 20, 2025
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: Internal 🏠 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changes to .browserslistrc does not invalidate cache

5 participants