Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have been trying for hours to figure out what is going on with Babel. It is not outputting anything close to what it should.

Shown here:

I can provide any context/files that you may need to deduce a solution. Thanks.

sample script.js function:

var nameBuilder = function(firstName="John", lastName="Doe") {
console.log(firstName + " " + lastName);
};

nameBuilder();


Babel output (came in one block of code so I did not indent):

!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),r.l=!0,r.exports}t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=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.exports=t(0)}]);


What I have tried:

Spent hours reinstalling stuff, searching for the answer. I haven't been able to find someone with this problem.
Posted
Updated 28-Feb-18 2:32am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900