We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
TypeScript export default as syntax seems not working with this module. Considering the following TS code:
export { default as fs } from 'fs';
Test its output with cjs-module-lexer:
cjs-module-lexer
const { parse } = require('cjs-module-lexer'); const result = parse(` "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.fs = void 0; var fs_1 = require("fs"); Object.defineProperty(exports, "fs", { enumerable: true, get: function () { return __importDefault(fs_1).default; } }); `); console.log(result);
It prints:
{ exports: [ '__esModule' ], reexports: [] }
fs do not be considered as exports in the above case.
fs
And I also figure out that changing the place of the __importDefault call
__importDefault
var fs_1 = require("fs"); Object.defineProperty(exports, "fs", { enumerable: true, get: function () { return __importDefault(fs_1).default; } });
to something like this one (what babel does):
var fs_1 = __importDefault(require("fs")); Object.defineProperty(exports, "fs", { enumerable: true, get: function () { return fs_1.default; } });
The result will become:
{ exports: [ '__esModule', 'fs'], reexports: [] }
Is this an expected behavior?
Ref:
The text was updated successfully, but these errors were encountered:
Experiencing the same problem. react-share@4.4.0 is one such package and has no named exports except __esModule when imported from .mjs.
__esModule
.mjs
Sorry, something went wrong.
@guybedford Could you take a look on this? Is the behavior expected?
No branches or pull requests
Hi,
TypeScript export default as syntax seems not working with this module. Considering the following TS code:
Test its output with
cjs-module-lexer
:It prints:
fs
do not be considered as exports in the above case.And I also figure out that changing the place of the
__importDefault
callto something like this one (what babel does):
The result will become:
Is this an expected behavior?
Ref:
The text was updated successfully, but these errors were encountered: