alongubkin / alongubkin/spider

import/export broken because of IIFE

Aberta
#104 0 comentários 0 reações 1 responsável Reivindicada por @alongubkin Ver no GitHub
bug contributing-getting-started
Linguagem predominante
JavaScript
Estrelas
1.3k
Forks
46
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

I was examining our options for #50 and came across some annoying behavior. Because the compiler wraps everything in an IIFE, I can't seem to run generated ES6 module code through Traceur. For example, I ended up with code along the lines of:

``` es6
"use strict";
(function() {
import A from "A";
function B() { }
export default B;
})();
```

but that won't fly because Traceur expects the `import` to be outside of the IIFE.

For now, I've added an extra task to my Gruntfile to strip out the IIFE. However, we should either have a way to make the IIFE optional, or, preferably, hoist the imports out of it and return the exports from it.

(Or am I doing something horribly wrong? I'm basically compiling my code to ES6, then creating a System.js build from it, and finally loading it in Chrome. With the IIFE patch, that works well.)

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.