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

syntax error with export default #598

Open
alexlamsl opened this issue Mar 6, 2021 · 1 comment
Open

syntax error with export default #598

alexlamsl opened this issue Mar 6, 2021 · 1 comment

Comments

@alexlamsl
Copy link

$ cat in/test.ts
export default function() {} console.log(42);

$ sucrase in -d out -t typescript,imports
in/test.ts -> out/test.js

$ node -v
v14.16.0

$ node out/test.js
/Users/alexlamsl/Desktop/UglifyJS/tmp/out/test.js:1
"use strict";Object.defineProperty(exports, "__esModule", {value: true});exports. default = function() {} console.log(42);
                                                                                                          ^^^^^^^

SyntaxError: Unexpected identifier
    at wrapSafe (internal/modules/cjs/loader.js:979:16)

$ mv in/test.ts in/test.mjs
$ node in/test.mjs
42
@FDiskas
Copy link

FDiskas commented Oct 6, 2023

It is expected behavior?
https://github.com/search?q=repo%3Aalangpierce%2Fsucrase+%22exports.+default%22&type=code

The space after exports also visible in this demo https://sucrase.io/#compareWithTypeScript=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants