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

Bug: babel.generated is not a function

nukisman opened this issue · comments

I try to follow docs from this section https://github.com/rollup/rollup-plugin-babel#running-babel-on-the-generated-code

But babel.generated not exists:

rollup.config.js

// ...
import babel from 'rollup-plugin-babel';

const plugins = [
  // ...
  babel.generated({
    presets: ['@babel/env']
  }),
  // ...
];
$ rollup -c -w
[!] TypeError: babel.generated is not a function
TypeError: babel.generated is not a function
    at Object.<anonymous> (/project/rollup.config.js:23:9)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.require.extensions.(anonymous function) [as .js] (/project/node_modules/rollup/dist/bin/rollup:818:24)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at rollup_js.rollup.then.then (/project/node_modules/rollup/dist/bin/rollup:825:32)

package.json:

{
  // ...
  "devDependencies": {
    "rollup": "^1.27.5",
    "rollup-plugin-babel": "^4.3.3",
     // ...
  }
}

I ran into the same trap.
This is a rather new functionality (7 hours old) and there is just no new release on npm... yet.

Yes, sorry for that - I guess we should add an unreleased label to this for the time being. I'm going to move things forward to get this released as soon as possible, but it might take a few days.

Any workaround to this? Just ran into this as well, can an alpha release be made or something in the meantime?

@gingur I'm going to cut a new alpha v5 release this week so stay tuned.

It looks like v5.0.0-alpha.0 was released on top of an 11 month old comment 😕

Yep,

$ npm list | grep rollup-plugin-babel
  rollup-plugin-babel@5.0.0-alpha.0

Still gives

[!] TypeError: babel.generated is not a function

As you can see here https://www.npmjs.com/package/rollup-plugin-babel/v/5.0.0-alpha.0 this version is a year old and has nothing to do with the current implementation on master.

I've just published new rollup-plugin-babel@next (5.0.0-alpha.1) with this feature included - please give it a try.