Closed axe-z closed 7 years ago
Hey @axe-z Have a look at this babel plugin. and make sure that you prove babel-polyfill in your project
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"
]
}
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.
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"] } };
tks , i'll try that, this really runs GENERATORS ? if so tks alot.
In any case, this should really realy , I mean really be simpler. with presets like : latest ...
Use babel-plugin-transform-runtime
to fix this issue.
babel-polyfill works for me in my vue-test-utils unit test with mocha.
I had the same problem using webpack with babel 7. i imported regenerator-runtime/runtime
in main app
entry file and works fine.
I did import '@babel/polyfill'
and fixed it in babel7
Fixed by adding
import 'core-js/stable';
import 'regenerator-runtime/runtime';
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...
I just want a loader preset that can run GENERATORS. Any idea ?