Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] A negative case #5

Closed
AngusFu opened this issue Jun 2, 2020 · 1 comment
Closed

[Bug] A negative case #5

AngusFu opened this issue Jun 2, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@AngusFu
Copy link

AngusFu commented Jun 2, 2020

Example

const { ModuleKind, transpileModule } = require('typescript');
const { cjsToEsm } = require('@wessberg/cjs-to-esm-transformer');

const result = transpileModule(
  `
    export const SomeLib = require('lib-2');
    export const SomeLibVar = require('lib-2').someVar;
  `,
  {
    transformers: cjsToEsm(),
    compilerOptions: {
      module: ModuleKind.ESNext,
      target: ModuleKind.ESNext
    }
  }
);

console.log(result.outputText);

Output

import SomeLib from "lib-2";
export const SomeLibVar = SomeLib.someVar;

image

Expecting

import SomeLib from "lib-2";

export { SomeLib };
export const SomeLibVar = SomeLib.someVar;
@wessberg wessberg added the bug Something isn't working label Jun 24, 2020
@wessberg
Copy link
Owner

wessberg commented Jul 1, 2020

Hi there. Thanks for reporting this issue. It has been fixed in v0.0.22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants