rollup / rollup-plugin-babel

This package has moved and is now available at @rollup/plugin-babel / https://github.com/rollup/plugins/tree/master/packages/babel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bundle requires core-js internals

johannes-z opened this issue · comments

My final bundle has a lot of statements like the following, even though I'm using @rollup/plugin-node-resolve and @rollup/plugin-commonjs:

var $ = require('../internals/export')

var isObject = require('../internals/is-object');

var isArray = require('../internals/is-array');

I've created a repro here: https://github.com/johannes-z/rollup-babel-yarn
This is the bundle generated: https://github.com/johannes-z/rollup-babel-yarn/blob/master/packages/consumer/lib/main.js

For babel I'm using @babel/preset-env with useBuiltIns: 'usage', so that Promise gets polyfilled as well.

Ref: #312

It's because in packages/consumer/rollup.config.js you are only excluding consumer's node_modules, but core-js comes from the top-level node_modules. For this reason, Babel injects imports to core-js in core-js itself, causing problems.

You can fix it by using exclude: /node_modules/, which will ignore all the node_modules folders.

Thanks, that was it.