Feature request: Different browserslistEnv based on webpack target.
- Dominant language
- JavaScript
- Stars
- 4.8k
- Forks
- 456
- Avg merge
- 9h 19m
- Merged PRs (30d)
- 2
Description
## **BEFORE YOU SUBMIT** please read the following:
**I'm submitting a feature request**
**Webpack Version:**
5.84.1
**Babel Core Version**:
7.22.1
**Babel Loader Version**:
9.1.2
**Please tell us about your environment:**
Windows 10
**Current behavior:**
I'm building multiple versions with different configurations (browser, capacitor etc.) at the same time.
I would like to use different browserslist environments for different versions.
Webpack supports setting [browserslist environment](https://webpack.js.org/configuration/target/#browserslist), but that doesn't affect babels [browserslistEnv](https://babeljs.io/docs/options#browserslistenv).
I tried to get target it with api.caller(), and it seems webpack doesn't pass the original target but only passes some hardcoded values such as "web" or "node".
I probably could give full babel configuration with browserslistEnv to babel-loader in webpack config but I would prefer separate babel.config.js.
**Expected/desired behavior:**
I would like to somehow be able to change browserslistEnv based on webpack build configuration while using separate babel.config.js and .browserslistsrc files.
Contributor guide
Research direction
Start by tracing how babel-loader receives webpack's target and how it passes configuration to Babel. Compare webpack's browserslist environment handling with Babel's browserslistEnv option, using the versions and links in the issue as the initial references. Done means separate babel.config.js and .browserslistsrc configurations can select browserslist environments for different webpack builds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, webpack
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100