Include a basic working template using babel 7
mcshaz opened this issue · 2 comments
I am trying to get the most incredibly basic example building. I have set up a repository at https://github.com/mcshaz/simple-rollup-babel-test
the most straight forward package.json I think I need is
"devDependencies": {
"@babel/core": "^7.7.7",
"@babel/preset-env": "^7.7.7",
"@rollup/plugin-commonjs": "^11.0.0",
"@rollup/plugin-node-resolve": "^6.0.0",
"core-js": "^3.6.0",
"rollup": "^1.27.14",
"rollup-plugin-babel": "^4.3.3"
},
and likewise for the rollup.config.js
import babel from 'rollup-plugin-babel';
import 'core-js';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
export default {
input: 'input.js',
output: [{
file: 'output-iife.dist.js',
format: 'iife',
name: 'test'
}, {
file: 'output-amd.dist.js',
format: 'amd',
}, {
file: 'output-cjs.dist.js',
format: 'cjs',
},
],
plugins: [
babel({
babelrc: false,
include: `*.js`,
exclude: `node_modules/**`,
presets: [[ '@babel/preset-env',
{
modules: false,
useBuiltIns: 'usage',
targets: { ie: "8" },
corejs: 3,
}]],
}),
resolve(),
commonjs()
],
};
but the simple example won't build:
> rollup -c
input.js → output-iife.dist.js, output-amd.dist.js, output-cjs.dist.js...
[!] Error: Unexpected token
node_modules/core-js/internals/parse-int.js (11:14)
9: // `parseInt` method
10: // https://tc39.github.io/ecma262/#sec-parseint-string-radix
11: module.exports = FORCED ? function parseInt(string, radix) {
^
can someone please help me get this building/transpiling and I will leave the repo as a starting point for people.
This is a bug in @rollup/pluginutils
used by @rollup/plugin-commonjs
. I've prepared a fix for it here: rollup/plugins#116
The fix has been merged to @rollup/pluginutils
. It hasn't been released yet though - I recommend waiting for that release. Going to close this issue as it doesn't belong to this repository, hope you understand.