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

Incompatibility with TypeScript (edge case) #76

Open
pfumagalli opened this issue Nov 9, 2022 · 3 comments
Open

Incompatibility with TypeScript (edge case) #76

pfumagalli opened this issue Nov 9, 2022 · 3 comments
Labels
edge case wontfix This will not be worked on

Comments

@pfumagalli
Copy link

I have a very simple TypeScript file:

export { default as bar } from './bar'

When transpiled with tsc (4.8) and esModuleInterop set to true the transpiled code will somehow look like this:

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.bar = void 0;
var bar_1 = require("./bar");
Object.defineProperty(exports, "bar", { enumerable: true, get: function () { return __importDefault(bar_1).default; } });

In this case, the lexer seems to be ignoring the bar export.

@pfumagalli
Copy link
Author

sample.zip

Attaching a little sample...

@pfumagalli
Copy link
Author

Moving the __importDefault statement outside of the getter makes things work (omitting the rest for brevity):

var bar_1 = __importDefault(require("./bar"));
Object.defineProperty(exports, "bar", { enumerable: true, get: function () { return bar_1.default; } });

@chentsulin
Copy link

Same as #69

badeball added a commit to badeball/cypress-cucumber-preprocessor that referenced this issue Sep 13, 2023
This specifically is kind of broken, in that tsc's output in this
scenario is unrecognized by Node's lexer [1].

[1] nodejs/cjs-module-lexer#76
badeball added a commit to badeball/cypress-cucumber-preprocessor that referenced this issue Sep 16, 2023
This specifically is kind of broken, in that tsc's output in this
scenario is unrecognized by Node's lexer [1].

[1] nodejs/cjs-module-lexer#76
@guybedford guybedford added edge case wontfix This will not be worked on labels Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
edge case wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants