Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
53 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
For some cases could be useful to exclude some `core-js` features or generate a polyfill for target engines. This API helps conditionally include or exclude certain parts of [`core-js`](https://github.com/zloirock/core-js), use `browserslist` queries from [`core-js-compat`](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat) package. | ||
|
||
```js | ||
require('core-js-builder')({ | ||
modules: ['es', 'esnext.reflect', 'web'], // modules / namespaces, by default - all `core-js` modules | ||
exclude: ['es.math', 'es.number.constructor'], // a blacklist of modules / namespaces, by default - empty list | ||
targets: '> 0.5%', // optional browserslist query | ||
filename: './my-core-js-bundle.js', // optional target filename, if it's missed a file will not be created | ||
}).then(code => { // code of result polyfill | ||
// ... | ||
}).catch(error => { | ||
// ... | ||
const builder = require('@core-js/builder'); | ||
|
||
const bundle = await builder({ | ||
modules: ['es', 'esnext.reflect', 'web'], // modules / namespaces, by default - all `core-js` modules | ||
exclude: ['es.math', 'es.number.constructor'], // a blacklist of modules / namespaces, by default - empty list | ||
targets: '> 0.5%, not dead, ie 9-11', // optional browserslist or core-js-compat format query | ||
summary: { // shows summary for the bundle, disabled by default: | ||
console: { size: true, modules: false }, // in the console, you could specify required parts or set `true` for enable all of them | ||
comment: { size: false, modules: true }, // in the comment in the target file, similarly to `summary.console` | ||
}, | ||
filename: './my-core-js-bundle.js', // optional target filename, if it's missed a file will not be created | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters