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

Default export all members from original module to prevent missing named exports members #522

Merged
merged 3 commits into from
Feb 17, 2023

Conversation

Justinidlerz
Copy link
Contributor

@Justinidlerz Justinidlerz commented Feb 16, 2023

image

https://unpkg.com/[email protected]/es/Dom/dynamicCSS.js
https://esm.sh/v106/[email protected]/es2022/es/Dom/dynamicCSS.js
The module is exported members but will be moved to the default export
image
Add the reexport members to fix this problem
image

@ije
Copy link
Member

ije commented Feb 16, 2023

seems this breaks other package,please check the CI testing

@Justinidlerz
Copy link
Contributor Author

Justinidlerz commented Feb 16, 2023

I fixed the previous bug and the tests are normally started and passed on locally.
image

Don't know why failed this one
error: Failed to fetch "[email protected]".
Do you have some idea? @ije
image

@ije
Copy link
Member

ije commented Feb 16, 2023

hmm, now the testing failed on main branch too, seems it's upstream io timeout, i will look into it

@ije
Copy link
Member

ije commented Feb 16, 2023

by the way, can you please add a testing for the PR?

@Justinidlerz
Copy link
Contributor Author

sure

@ije
Copy link
Member

ije commented Feb 16, 2023

thanks, i just updated the default npm CDN to jsdelivr, seem unpkg has io limit i don't know why

@@ -197,6 +197,8 @@ func (task *BuildTask) build(marker *stringSet) (esm *ESM, err error) {
buf := bytes.NewBuffer(nil)
importPath := task.Pkg.ImportPath()
fmt.Fprintf(buf, `import * as __module from "%s";`, importPath)
// Default reexport all members from original module to prevent missing named exports members
fmt.Fprintf(buf, `export * from "%s";`, importPath)
Copy link
Member

@ije ije Feb 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe only add this when len(esm.Exports) === 0 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think can always export from the origin, and the esm.Exports will overwrite the same name exports

@Justinidlerz
Copy link
Contributor Author

Hei @ije, I has been add the test for this PR. could you please review again

@Justinidlerz Justinidlerz changed the title Default reexport all members from original module to prevent missing named exports members Default export all members from original module to prevent missing named exports members Feb 17, 2023
@Justinidlerz Justinidlerz requested review from ije February 17, 2023 09:09
Copy link
Member

@ije ije left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍👍👍

@ije ije merged commit 1f6ba56 into esm-dev:main Feb 17, 2023
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.

2 participants