[Bug]: The documentation for babel-plugin-polyfill-corejs3 seems to have an error description?
- Dominant language
- TypeScript
- Stars
- 357
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
### 💻
- [ ] Would you like to work on a fix?
### How are you using Babel?
babel-loader (webpack)
### Input code
```js
import 'core-js/stable';
```
### Configuration file name
_No response_
### Configuration
```js
const presets = [
[
'@babel/preset-env',
{
targets: 'ie 11',
}
]
]
const plugins = [
[
'babel-plugin-polyfill-corejs3',
{
method: "entry-global",
version: require("core-js/package.json").version
}
],
'@babel/plugin-transform-runtime',
];
module.exports = {plugins, presets};
```
### Current and expected behavior
- When the value of version is the latest `version` of `core-js` (`require("core-js/package.json").version`), the compiled code is injected with `224 lines`.
```js
require("core-js/modules/es.symbol.js");
...
require("core-js/modules/web.url-search-params.size.js");
```
- When I change the version to `3.20`, the compiled code is injected with `208 lines`.
```js
require("core-js/modules/es.symbol.js");
...
require("core-js/modules/web.url-search-params.js");
```
Hello, I am migrating from the old configuration method to the new one.
I see from the [documentation](https://github.com/babel/babel-polyfills/tree/main/packages/babel-plugin-polyfill-corejs3)
> This option only has an effect when used alongside "method": "usage-global" or "method": "usage-pure".
that version only works if you use `"method": "usage-global" `or `"method": "usage-pure"`.
But when I changed the value of version, I found that it worked. So the version configuration item also acts on `"method": "entry-global"`?
### Environment
System:
OS: macOS 12.2.1
Binaries:
Node: 14.18.1 - /usr/local/bin/node
npm: 6.14.15 - /usr/local/bin/npm
npmPackages:
@babel/cli: ^7.21.0 => 7.21.0
@babel/core: ^7.21.4 => 7.21.4
@babel/plugin-transform-runtime: ^7.21.4 => 7.21.4
@babel/preset-env: ^7.21.4 => 7.21.4
@babel/runtime-corejs3: ^7.21.5 => 7.21.5
babel-loader: ^9.1.2 => 9.1.2
babel-plugin-polyfill-es-shims: ^0.8.0 => 0.8.0
babel-plugin-polyfill-regenerator: ^0.4.1 => 0.4.1
webpack: ^5.81.0 => 5.81.0
### Possible solution
_No response_
### Additional context
_No response_
Contributor guide
Research direction
Read the babel-plugin-polyfill-corejs3 documentation linked in the issue and reproduce the supplied babel-loader configuration using entry-global with the latest core-js and version 3.20. Compare the injected modules, then clarify the version option's documented scope so it accurately reflects the observed behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, webpack
- Domain
- build-system, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100