const fs = require('fs');
const filename = './my-core-js-bundle.js';
require('core-js-builder')({
modules: ['es'], // modules / namespaces, by default - all `core-js` modules
blacklist: [], // blacklist of modules / namespaces, by default - empty list
targets: 'chrome 80', // optional browserslist query
filename, // optional target filename, if it's missed a file will not be created
}).then(code => { // code of result polyfill
console.log(code);
fs.writeFileSync(filename, code);
}).catch(error => {
// WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
console.error(error);
});