buxlabs / amd-to-es6

convert amd to es
MIT License
35 stars 17 forks source link

proxy modules do not get converted #116

Closed mikehaverstock closed 5 years ago

mikehaverstock commented 5 years ago

Example:

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

const input = `
define(function (require) {
  return require('./foo');
});
`

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

Actual:

export default require("./foo");

Expected:

import a from "./foo";
export default a;
emilos commented 5 years ago

@mikehaverstock thanks again, I've included a test for this use case and released as v0.14.2. Due to the limited time I have I didn't handle nested member expressions like:

define(function (require) {
  return require('./foo').bar;
});
define(function (require) {
  return require('./foo').bar.baz;
});

It should be pretty easy to handle though based on the related code. PRs highly appreciated.