-
Notifications
You must be signed in to change notification settings - Fork 509
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
Problem with target = CommonJS in tsconfig #345
Comments
not sure. if you can investigate and propose a fix, please be my guest |
In my opinion but not sure I think it’s problem from rollup. Maybe next week if I’ve time I’ll try looking about this |
I think the problem is that tsdx use 'named' exports rather than 'auto' exports(which is rollup's default behavior ), which I think auto is more appropriate for the ugly export default 42; auto mode generates 'use strict';
var main = 10;
module.exports = main; named mode generates 'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var main = 10;
exports.default = main; and auto mode works perfectly with node && browser const lib = require('lib') // ok import lib from 'lib' // ok when set esmoduleInterop: true |
I also came across the same issue while building a Node library. Is there a suggested |
Current Behavior
I'm about to use tsdx to build library for Node.js but it still need to add .default after require. So I'm tried to change to
export =
and tsconfig target to CommonJS thenis it possible to solve this issue?
Who does this impact? Who is this for?
Who using
export =
and target as commonjsThe text was updated successfully, but these errors were encountered: