We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
我们在项目中尝试使用es6/7语法编写模块,如
define(function(){ var func2 = function(){ return new Promise((reslove)=>{ setTimeout(function(){ reslove(10); },1000) }) } var func1 = async function(){ var a = await func2(); return a; } func1(); })
babel编译后
"use strict"; function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } define(function () { var func2 = function func2() { return new Promise(function (reslove) { setTimeout(function () { reslove(10); }, 1000); }); }; var func1 = function () { var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { var a; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: _context.next = 2; return func2(); case 2: a = _context.sent; return _context.abrupt("return", a); case 4: case "end": return _context.stop(); } } }, _callee, this); })); return function func1() { return _ref.apply(this, arguments); }; }(); func1(); });
在这个地方babel生成了一个函数_asyncToGenerator,附在模块外面。如果使用nej打包工具,这段函数_asyncToGenerator会被删除,对比了其他打包工具webpack以及require.js的r.js,是不会去删除该函数的,请问有什么方法能解决吗
_asyncToGenerator
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我们在项目中尝试使用es6/7语法编写模块,如
babel编译后
在这个地方babel生成了一个函数_asyncToGenerator,附在模块外面。如果使用nej打包工具,这段函数
_asyncToGenerator
会被删除,对比了其他打包工具webpack以及require.js的r.js,是不会去删除该函数的,请问有什么方法能解决吗The text was updated successfully, but these errors were encountered: