New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ReferenceError: regeneratorRuntime is not defined #484

Closed
axe-z opened this Issue Jun 25, 2017 · 7 comments

Comments

Projects
None yet
5 participants
@axe-z

axe-z commented Jun 25, 2017

I want to use webpack for my presets, no babelrc, there are so many preset's everywhere on the web, it's hard to know which way to go, I' ve tired everything...

 {
           test: /\.js$/,
           exclude: /(node_modules|bower_components)/,
           use: {
             loader: 'babel-loader',
             options: {
                presets: ["es2015",'stage-0', "es2015-native-modules-and-generators", 'stage-1', 'stage-2', 'stage-3', 'react']
         }
     }
},

I just want a loader preset that can run GENERATORS. Any idea ?

@Krizzu

This comment has been minimized.

Show comment
Hide comment
@Krizzu

Krizzu Jun 28, 2017

Hey @axe-z
Have a look at this babel plugin.
and make sure that you prove babel-polyfill in your project

Krizzu commented Jun 28, 2017

Hey @axe-z
Have a look at this babel plugin.
and make sure that you prove babel-polyfill in your project

@hzoo

This comment has been minimized.

Show comment
Hide comment
@hzoo

hzoo Jun 28, 2017

Member

You can't combine both es2015-native-modules-and-generators and es2015 because it will run the regenerator transform.

Babel preset for all es2015 plugins MINUS TWO:

babel-plugin-transform-es2015-modules-commonjs
babel-plugin-transform-regenerator

I would remove both and use https://github.com/babel/babel-preset-env. You don't need stage-0,1,2,3. Stage 0 includes 1, which includes 2, etc.

{
  "presets": [
    ["env", {
      "targets": { node: "6" }, // specify targets here
    }]
    "stage-0",
    "react"
  ]
}
Member

hzoo commented Jun 28, 2017

You can't combine both es2015-native-modules-and-generators and es2015 because it will run the regenerator transform.

Babel preset for all es2015 plugins MINUS TWO:

babel-plugin-transform-es2015-modules-commonjs
babel-plugin-transform-regenerator

I would remove both and use https://github.com/babel/babel-preset-env. You don't need stage-0,1,2,3. Stage 0 includes 1, which includes 2, etc.

{
  "presets": [
    ["env", {
      "targets": { node: "6" }, // specify targets here
    }]
    "stage-0",
    "react"
  ]
}

@hzoo hzoo closed this Jun 28, 2017

@axe-z

This comment has been minimized.

Show comment
Hide comment
@axe-z

axe-z Jun 28, 2017

I'm asking if it's possible, to add a preset, IN WEBPACK, that would handle generators.
I do know that the list i've got there is to much, but still this will not run generators.

axe-z commented Jun 28, 2017

I'm asking if it's possible, to add a preset, IN WEBPACK, that would handle generators.
I do know that the list i've got there is to much, but still this will not run generators.

@cjohnweb

This comment has been minimized.

Show comment
Hide comment
@cjohnweb

cjohnweb Aug 30, 2017

babel-polyfill

Here is a webpack.config.js file I use:

const path = require('path');

module.exports = {
entry: ['babel-polyfill', path.join(__dirname,'heartbeat.jsx')],
output: {filename: './pages/heartbeat/assets/heartbeat-bundle.js'},
module:{
rules: [{
test: [/.jsx?$/, /.js?$/],
exclude: /(node_modules)/,
use: [{
loader: 'babel-loader',
options: {
presets: ['es2015','react']
}
}]
}]
},
devtool: 'source-map',
resolve: {
extensions: [".js",".jsx"]
}
};

babel-polyfill

Here is a webpack.config.js file I use:

const path = require('path');

module.exports = {
entry: ['babel-polyfill', path.join(__dirname,'heartbeat.jsx')],
output: {filename: './pages/heartbeat/assets/heartbeat-bundle.js'},
module:{
rules: [{
test: [/.jsx?$/, /.js?$/],
exclude: /(node_modules)/,
use: [{
loader: 'babel-loader',
options: {
presets: ['es2015','react']
}
}]
}]
},
devtool: 'source-map',
resolve: {
extensions: [".js",".jsx"]
}
};

@axe-z

This comment has been minimized.

Show comment
Hide comment
@axe-z

axe-z Aug 30, 2017

tks , i'll try that, this really runs GENERATORS ? if so tks alot.

axe-z commented Aug 30, 2017

tks , i'll try that, this really runs GENERATORS ? if so tks alot.

@axe-z

This comment has been minimized.

Show comment
Hide comment
@axe-z

axe-z Aug 30, 2017

In any case, this should really realy , I mean really be simpler. with presets like : latest ...

axe-z commented Aug 30, 2017

In any case, this should really realy , I mean really be simpler. with presets like : latest ...

@tiendq

This comment has been minimized.

Show comment
Hide comment

tiendq commented Jun 19, 2018

Use babel-plugin-transform-runtime to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment