I’m trying to use async/await with a fresh project with aurelia cli (babel7, es, and the new aurelia bundler…)
But I’m getting the nasty "ReferenceError: regeneratorRuntime is not define ".
Looking out there in the docs of babel I have added to .babelrc.js plugins:
return {
“plugins”: [
[’@babel /plugin-transform-runtime’,
{
“corejs”: false,
“helpers”: true,
“regenerator”: true,
“useESModules”: false
}]
…
but it’s not working…any ideas?
bigopon
October 26, 2018, 11:30am
2
Did you try to add babel polyfill? A google for "ReferenceError: regeneratorRuntime is not define"
shows a lot of results related to missing babel polyfill
Not sure how to do it in au CLI but here is an example with webpack. Perhaps that can give you a clue…
"use strict";
const path = require("path");
const Webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { AureliaPlugin } = require("aurelia-webpack-plugin");
const resolve = filePath => path.resolve(__dirname, filePath);
module.exports = (env, argv) => {
const isDevMode = argv.mode !== "production";
return {
mode: isDevMode ? "development" : "production",
devtool: isDevMode ? "eval-source-map" : false,
entry: {
bundle: [
resolve("./node_modules/@babel/polyfill"),
resolve("./node_modules/aurelia-bootstrapper")
]
This file has been truncated. show original
Hi, in your main.js or main.ts file, add
import ‘babel-polyfill’;
Regards,
With babel7, it is import '@babel/polyfill';
.
Hey guys, thank you all for the answers… but none of them worked for me.
I have left it for the moment because I have other priorities … and in the end I will also convert all the code to typescript.
@jrogalan would you mind to open an issue in cli github repo? I will try to fix the skeleton after my vacation.
1 Like
Hi @jrogalan ,
I managed to get async
await
working with by adding this to prepend in aurelia.json
aurelia.json
…
“name”: “vendor-bundle.js”,
“prepend”: [
“node_modules/@babel /polyfill/dist/polyfill.min.js”,
“node_modules/bluebird/js/browser/bluebird.core.js”,
…
1 Like
@LetsZiggy thank you! its works like a charm…