Skip to content

require assignments not converted to imports when declaration separation from assignment #114

@mikehaverstock

Description

@mikehaverstock

Coffeescript outputs code like this.

Repro

const amd_to_es6 = require('@buxlabs/amd-to-es6');

const input = `
define(function (require) {
  var x, y, Foo;
  x = 1;
  y = 'bar';
  Foo = require('foo');
  exports.Foo = Foo;
});
`

output = amd_to_es6(input);
console.log(output)

Actual:

var x, y, Foo;
x = 1;
y = 'bar';
Foo = require("foo");
exports.Foo = Foo;

Expected:

import Foo from "foo";
var x, y;
x = 1;
y = 'bar';
exports.Foo = Foo;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions