Giter Club home page Giter Club logo

Comments (22)

sebmck avatar sebmck commented on May 13, 2024

As documented in the caveats, generators use require the 6to5 polyfill or the regenerator runtime.

from babelify.

qubyte avatar qubyte commented on May 13, 2024

My apologies, and thanks for the quick response. I didn't spot that tab.

from babelify.

tusharmath avatar tusharmath commented on May 13, 2024

Generators a supported by default by chrome ( 45.0.2454.93 (64-bit)). It still doesn't work.

from babelify.

trusktr avatar trusktr commented on May 13, 2024

@tusharmath That's because if you compile it to ES5 it's not using the browser's native features, so it depends on the regenerator library for the ES5 code to work (the ES5 code doesn't actually use generators). Babel isn't planning to support feature detection.

from babelify.

trusktr avatar trusktr commented on May 13, 2024

@sebmck What's your recommended way of making the regenerator runtime available? Without also loading the core-js stuff from the polyfill?

from babelify.

sebmck avatar sebmck commented on May 13, 2024

https://github.com/babel/babel#looking-for-support

from babelify.

trusktr avatar trusktr commented on May 13, 2024

@sebmck It's hard to keep track of discussion on Slack, and SO has too much other stuff. Have you considered Discourse (discourse.org)?

from babelify.

jmm avatar jmm commented on May 13, 2024

@trusktr Not much has been done with it yet, and there may be some issues with sign up, but there's https://discuss.babeljs.io/.

from babelify.

trusktr avatar trusktr commented on May 13, 2024

@jmm That looks great!! Any plans to put that on the front page?

from babelify.

jmm avatar jmm commented on May 13, 2024

@trusktr Yeah, I, or whomever, just has to do it sometime. babel/website#535

from babelify.

adamkdean avatar adamkdean commented on May 13, 2024

I'm also getting issues using require("babel-core/register") with co.

Trace: ReferenceError: regeneratorRuntime is not defined

I'm not running this in the browser, but I want JSX support via babel without having to transpile beforehand. Any ideas?

from babelify.

xpepermint avatar xpepermint commented on May 13, 2024

@adamkdean I fixed the regeneratorRuntime error by adding the babel-plugin-transform-runtime plugin.

from babelify.

adamkdean avatar adamkdean commented on May 13, 2024

Thanks, I decided to solve it another way but I'll keep this in mind in case I run into this again.

from babelify.

SerkanSipahi avatar SerkanSipahi commented on May 13, 2024

@xpepermint babel-plugin-transform-runtime works fine for me !

from babelify.

jonesnc avatar jonesnc commented on May 13, 2024

I also had to install babel-polyfill and include require('babel-polyfill') at the top of my source file to fix this issue.

I found this issue, and the solution for it here (google cache linked).

from babelify.

wangxiao avatar wangxiao commented on May 13, 2024

babel-plugin-transform-runtime not works.
have an error

Module not found: Error: Cannot resolve module 'babel-runtime/core-js/promise'

@SerkanSipahi @xpepermint

    module: {
      loaders: [
        {
          test: /\.js$/,
          exclude: /node_modules/,
          loader: "babel-loader",
          query: {
            presets: ['es2015', 'stage-3'],
            plugins: ['transform-runtime']
          }
        }
      ]
    },

from babelify.

jonesnc avatar jonesnc commented on May 13, 2024

Do you have the babel-runtime module installed? npm install babel-runtime should do the trick.

from babelify.

wangxiao avatar wangxiao commented on May 13, 2024

@jonesnc thanks, but after install babel-runtime, have a new error in browser. 😂

Uncaught TypeError: (0 , _typeof3.default) is not a function

The source file is

export default () => {
  'ngInject';

  const f = () => {
    return new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve(123);
      }, 2000);
    });
  };

  const testAsync = async () => {
    const t = await f();
    console.log(t);
  };

  testAsync();
};

from babelify.

gscottolson avatar gscottolson commented on May 13, 2024

I am seeing a similar error in the browser: Uncaught TypeError: (0 , _typeof3.default) is not a function

from babelify.

juanramirezc2 avatar juanramirezc2 commented on May 13, 2024

same here !!

from babelify.

mkozjak avatar mkozjak commented on May 13, 2024

same here :)

from babelify.

zertosh avatar zertosh commented on May 13, 2024

"Same here" without any info, makes it impossible to figure out what's going on. Please open a new issue with details like (1) what's the exact transform you're running? (2) what versions of babel & friends (3) what code you're running it on. Preferably with a repro case.

from babelify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.