238 questions
0 votes
0 answers
70 views
Webpack + Vue Storefront: dist .js file contains multiple "\n//\n"
I'm working on a Vue Storefront (link to Github repo) project and looking at a filed build by Webpack I see that is full of \n//\n//\n//\n//\n//\n//\n/* harmony default export */ sometimes this ...
34 votes
1 answer
21k views
What is harmony and what are harmony exports?
What is this harmony exports? In fact, what is harmony? Background When I bundle stuff using Webpack and I look at the distribution source, it contains this one block always. // define getter ...
1 vote
1 answer
2k views
Usage of object destructuring in Array.reduce
I was trying to solve another person's problem on SO using Array.prototype.reduce and ...object destructuring. I don't understand why it works as expected when I'm using Object.assign, but not when ...
0 votes
0 answers
46 views
Find ES6-module in which entity is declared
TL;DR There is some imported entity on ES6-module. Should find original ES module and line number, where this entity has been initially declared - not re-imported / re-exported. There is some ...
3 votes
1 answer
1k views
Restructuring TypeScript internal modules to external modules
I have a website that uses a large typescript code base. All clases as in their own files, and wrapped with an internal module like so: file BaseClass.ts module my.module { export class BaseClass ...
9 votes
1 answer
2k views
How to tell eslint to allow staged ECMA-Script dynamic imports
I want to use the now "Stage-3" proposal import(). If I lint my code with ESLint it's complaining about: Parsing error: 'import' and 'export' may only appear at the top level Which is correct for the ...
1 vote
0 answers
88 views
Running a node command in harmony irrespective of OS
So for a *nix machine, it is possible to define a script like so: scripts: { "unit-test": "node --harmony `which jest` --config jest-unit.json" } This fails on Windows 10 as the which command is ...
0 votes
1 answer
82 views
Using Harmony-proxy on Webserver node.js
I have a node.js code that runs a webserver and in this I'll like to use proxy Proxy link: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Proxy I'm using this shim: ...
2 votes
1 answer
2k views
Why does `enable-javascript-harmony` prevent StackOverflows in Web Workers?
I have some code compiled from Ocaml to Javascript using js_of_ocaml. Now, when moving that code to work in a Web Worker thread, I started to get StackOverflows. However, when I run the code on the ...
0 votes
1 answer
187 views
ES6: harmony-proxies: Why does `tracedObj.squared(9)` return undefined?
Why does tracedObj.squared(9) return undefined? This likely has something to do with the scope of obj being in the wrong scope for it's this call in squared after it calls a method on it's own object....
0 votes
0 answers
128 views
ES2015 Proxy Composition
I have been searching high and low for any straightforward answer to this question and, sadly, must now come to the internet community at large and ask a question. Simply put, I would like to know if ...
2 votes
1 answer
1k views
Harmony destructuring ReferenceError: Invalid left-hand side in assignment
This a weird behaviour, i've tested on Chrome and works just fine without any flag, but in node it doesn't work event with the latest version $ node --harmony_destructuring app.js [length, offset] = ...
1 vote
0 answers
60 views
String literal to template literal [duplicate]
Is there a way to convert a string literal into a template literal in Javascript 2015? For example, something like the opposite of String.raw, like this: String.template('hello ${name}!') // ...
1 vote
2 answers
581 views
Why does babel translate async/await to regenerators?
All version of babel translate an await statement to a _asyncToGenerator call, it obviously has some shortcomings: Code size grows dramatically Requires the regeneratorRuntime library From my ...
15 votes
1 answer
23k views
TypeError: redeclaration of let error in Firebug console if running ES6 code
I am learning ES6, so bear me please. Following is the code which is running fine, if I click the Run button one time, but on second hit it starts showing TypeError: redeclaration of let myArr error. ...