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: externalize optimizeDeps.exclude via rolldownCjsExternalPlugin (fix test-serve playground/external) #31

Merged

Conversation

hi-ogawa
Copy link
Member

@hi-ogawa hi-ogawa commented Jul 25, 2024

Description

Currently optimizeDeps.exclude is externalized at the config level rolldown.rolldown({ external: ... }) and it looks like rolldownCjsExternalPlugin doesn't have a chance to fixup cjs external. This manifests as test failures in playground/external.

Since rolldownCjsExternalPlugin also handles non-cjs external, I simply removed rolldown's external config and it looks like tests are passing.

Only the last commit 5edc81d is the actual fix and first commits are the same one from #28.

@hi-ogawa hi-ogawa marked this pull request as ready for review July 25, 2024 10:01
@hi-ogawa hi-ogawa changed the title fix: externalize optimizeDeps.exclude via rolldownCjsExternalPlugin fix: externalize optimizeDeps.exclude via rolldownCjsExternalPlugin (fix test-server playground/external) Jul 25, 2024
@hi-ogawa hi-ogawa changed the title fix: externalize optimizeDeps.exclude via rolldownCjsExternalPlugin (fix test-server playground/external) fix: externalize optimizeDeps.exclude via rolldownCjsExternalPlugin (fix test-server playground/external) Jul 25, 2024
@hi-ogawa hi-ogawa changed the title fix: externalize optimizeDeps.exclude via rolldownCjsExternalPlugin (fix test-server playground/external) fix: externalize optimizeDeps.exclude via rolldownCjsExternalPlugin (fix test-serve playground/external) Jul 25, 2024
@underfin
Copy link
Collaborator

@hi-ogawa I upgrade the lastet rolldown look like the playground/external could be work.

@underfin underfin force-pushed the rolldown-optimizer branch from f35336e to 8267755 Compare July 26, 2024 11:33
@hi-ogawa hi-ogawa force-pushed the fix-rolldownCjsExternalPlugin-2 branch from 5edc81d to da7294e Compare July 27, 2024 01:03
@hi-ogawa
Copy link
Member Author

I think playground/external is still failing (see #33). I added one commit on top of PR-33 and the test is passing here.

@hi-ogawa
Copy link
Member Author

It looks like CreateModuleContext.resolve_id https://github.com/rolldown/rolldown/blob/95b15b77340425186148badbee0c2dcf0280c484/crates/rolldown/src/types/module_factory.rs#L30-L51 checks external first, then if it matches, it won't call resolve_id_with_plugins, so it's necessary to remove external config to make it work.

@underfin
Copy link
Collaborator

Ok.

@underfin underfin merged commit e6ad145 into rolldown:rolldown-optimizer Jul 29, 2024
1 of 7 checks passed
@hi-ogawa hi-ogawa deleted the fix-rolldownCjsExternalPlugin-2 branch July 29, 2024 03:32
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