Using @babel/preset-env with core-js@3. Below is my babel config
module.exports = api => {
const config = {
presets: [
[
'@babel/preset-env',
{
modules: api.env('test') ? 'commonjs' : false,
useBuiltIns: 'usage',
corejs: 3,
exclude: ['es.promise'],
targets: { browsers: ['Android >= 4.4', 'iOS >= 10'] }
}
],
'@babel/preset-typescript'
],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-transform-runtime'
]
}
return config
}
and the output code is like below
import _regeneratorRuntime from '@babel/runtime/regenerator';
import 'regenerator-runtime/runtime';
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
import 'core-js/modules/es6.regexp.to-string';
import 'core-js/modules/es6.object.to-string';
import _objectSpread from '@babel/runtime/helpers/objectSpread';
...
But there is no core-js/modules/es6.object.to-string file at all.
@lili21 how did you resolve it?
rm -rf node_modules
yarn
Most helpful comment
rm -rf node_modulesyarn