Skip to content

Instantly share code, notes, and snippets.

@fabiotatsuo
Last active May 26, 2020 02:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiotatsuo/d1d48d0b9c5111f66332a5968de3347c to your computer and use it in GitHub Desktop.
Save fabiotatsuo/d1d48d0b9c5111f66332a5968de3347c to your computer and use it in GitHub Desktop.
Rollup 2.10.9 async/await

Links

rollup/rollup-plugin-babel#312
https://stackoverflow.com/questions/33527653/babel-6-regeneratorruntime-is-not-defined/36821986#36821986

  1. Install packages
$ npm i @babel/plugin-transform-runtime --save-dev
$ npm i @babel/runtime
  1. Rollup config

Update rollup.config.js

  plugins: [
    babel({
      babelHelpers: 'runtime',
      plugins: [
        '@babel/plugin-transform-runtime',
      ],
    }),
  ]

Other option

This option produce a bigger build js file.

  1. Install packages
$ npm i core-js
$ npm i regenerator-runtime
  1. Babel config

Update .babelrc

{
  "presets": [
    [
      "@babel/env",
      {
        "modules": false,
        "useBuiltIns": "usage",
        "corejs": 3,
      }
    ]
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment