Giter Club home page Giter Club logo

Comments (4)

emilos avatar emilos commented on September 6, 2024

hey @anandthakker, thanks for the detailed bug report. I've published v0.14.0 that includes a fix for this case. Could you please check if it helps? I'll close the issue, please feel free to reopen if anything else goes wrong.

from amd-to-es6.

mikehaverstock avatar mikehaverstock commented on September 6, 2024

I think this fixes the reported issue but now we just need to add one additional step to introduce another issue:

Start with

define(["require", "exports"], function (require, exports) {
    "use strict";
    if (false) {}
    var Foo = function () {};
    exports.default = Foo;
});

Actual Results

(function () {
  if (false) {}
  var Foo = function () {};
})();
var a = Foo;
export {a as default};

Notice that var Foo is declared within the IIFE so it cannot be accessed in this way.

Expected results

I'm not exactly sure what the expected results should be. Maybe:

var a;
(function () {
  if (false) {}
  var Foo = function () {};
  a = Foo
})();
export {a as default};

from amd-to-es6.

emilos avatar emilos commented on September 6, 2024

Thanks, makes sense, I wasn't sure what's the real life scenario here. It's probably fine to drop the iife completely in this case. I'll push an another fix tomorrow

from amd-to-es6.

emilos avatar emilos commented on September 6, 2024

@mikehaverstock I've pushed the other fix and released as v0.14.1. It's not ideal but it should hopefully handle this case a bit better.

from amd-to-es6.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.