Closed jmls closed 7 years ago
I don't see why babel runtime is needed here. Try it without the runtine.
ok, so I removed babel-runtime, and have this in the config:
babel: {
plugins: ['transform-async-to-generator']
}
everything compiles (good)
but I error in the browser (bad)
Uncaught ReferenceError: regeneratorRuntime is not defined
which is why I thought I needed the runtime in the first place ;)
Generators need the regeneratorRuntime
polyfill which comes from the babel-polyfill
module. You do need the modules and npm integration for that to work.
oh, blast. Thanks.
not that I'm against moving to npm and modules, but I'm somewhat stuck with how I convert my existing js files (see example below) over to a module format (I have several dozen .js files (1 for each controller / factory / service etc)
/* global angular */
(() => {
'use strict';
/** @ngInject */
function sdkFactory($http) {
return {};
}
angular
.module('myApp')
.factory('sdkFactory', sdkFactory);
})();
Closing, as not relevant anymore (I'm working out how to use ES6 modules).
thanks for the help.
I want to use the babel plugin http://babeljs.io/docs/plugins/transform-async-to-generator , in order to compile this code:
so I npm installed babel-runtime, and the appropriate babel plugins (and brunch plugins).
Everything compiles just peachy ;)
However, (there's always an however) - when it comes to running the app, I now get an error
and, indeed, looking at the generated application.js code, I see this
I am running with module wrapping false
Before I installed babel, everything was fine and dandy, and working well, so I suspect that babel has some requirements (see what I did there?) that conflict with the modules setting
What do I need to change in order to use babel ?