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

fix: add identifier for export default function without identifer #81

Merged
merged 2 commits into from
Oct 19, 2023

Conversation

underfin
Copy link
Contributor

@underfin underfin commented Oct 19, 2023

Description

The pr fixed some error with esm wrapped codegen and enable some esbuild passed test.

  • add identifier for export default function without identifier
  • avoid source mutation caused syntax error
export default class Foo {} Foo.prop = 123
// before
var Foo = class Foo {} Foo.prop = 123  // syntax error
// pr
var Foo = class Foo {}\n Foo.prop = 123 // add `\n` to avoid error

Test Plan

added.


@hyf0
Copy link
Member

hyf0 commented Oct 19, 2023

on hold for CR

@hyf0
Copy link
Member

hyf0 commented Oct 19, 2023

export default class Foo {} Foo.prop = 123
var Foo class Foo {}; Foo.prop = 123 // add `;` to avoid error

This looks confusing and invalid. What it means?

@underfin
Copy link
Contributor Author

I updated at description

@hyf0
Copy link
Member

hyf0 commented Oct 19, 2023

@underfin Are export default class Foo being renamed to var Foo = class Foo expected? or just a temporary workaround?

@underfin
Copy link
Contributor Author

Esbuild will codegen class Foo{} to var Foo = class {}, it is equals to var Foo = class Foo{}, so here not removed Foo.

@underfin underfin merged commit e84cde7 into main Oct 19, 2023
4 checks passed
@underfin underfin deleted the fix-export-default-case branch October 19, 2023 13:31
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

Successfully merging this pull request may close these issues.

None yet

2 participants