Skip to content
This repository was archived by the owner on Mar 19, 2026. It is now read-only.

fix: externalize optimizeDeps.exclude via rolldownCjsExternalPlugin (fix test-serve playground/external)#31

Merged
underfin merged 3 commits into
vitejs:rolldown-optimizerfrom
hi-ogawa:fix-rolldownCjsExternalPlugin-2
Jul 29, 2024
Merged

fix: externalize optimizeDeps.exclude via rolldownCjsExternalPlugin (fix test-serve playground/external)#31
underfin merged 3 commits into
vitejs:rolldown-optimizerfrom
hi-ogawa:fix-rolldownCjsExternalPlugin-2

Conversation

@hi-ogawa
Copy link
Copy Markdown

@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
Copy Markdown
Member

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Ok.

@underfin underfin merged commit e6ad145 into vitejs:rolldown-optimizer Jul 29, 2024
@hi-ogawa hi-ogawa deleted the fix-rolldownCjsExternalPlugin-2 branch July 29, 2024 03:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants