【发布时间】:2018-08-08 09:23:43
【问题描述】:
我已经尝试了几个小时来弄清楚 Babel 发生了什么。它没有输出任何接近它应该输出的东西。
我可以提供您推断解决方案可能需要的任何上下文/文件。谢谢。
示例 script.js 函数:
var nameBuilder = function(firstName="John", lastName="Doe") {
console.log(firstName + " " + lastName);
};
nameBuilder();
Babel 输出(来自一个代码块,所以我没有缩进):
!function(e){var n={};function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l :!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),rl=!0,r.exports}tm=e,tc=n,td= function(e,n,o){to(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},tr=function(e){ Object.defineProperty(e,"__esModule",{value:!0})},tn=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e} ;return td(n,"a",n),n},to=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},tp="",t(ts=1 )}([function(e,n,t){"use strict";!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"John",n =arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Doe";console.log(e+" "+n)}()},function(e,n,t){e.出口=t(0)}]);
【问题讨论】:
标签: javascript npm webpack ecmascript-6 babeljs