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

refactor: break circular dependencies to fix test-unit #18237

Merged
merged 3 commits into from
Sep 30, 2024

Conversation

sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Sep 30, 2024

Description

Some circular dependency in the code base was making the tests fail locally. This PR removes the circular dependencies to fix it.
related: https://discord.com/channels/804011606160703521/804439875226173480/1290196030847057961

Please check each commit message to see what circular dependency is removed.

…/environment.ts`

breaks the following circular dependecy:
config.ts ->
server/environments/runnableEnvironment.ts ->
server/environment.ts ->
config.ts
breaks the following circular dependency:
server/environment.ts
-> plugins/optimizeDeps.ts
-> optimizer/index.ts
-> optimizer/esbuildDepPlugin.ts
-> plugins/css.ts
-> build.ts
-> config.ts
-> server/environments/runnableEnvironment.ts
-> server/environment.ts
@sapphi-red sapphi-red added the p1-chore Doesn't change code behavior (priority) label Sep 30, 2024
Copy link

stackblitz bot commented Sep 30, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Comment on lines 34 to 46
export function getDefaultResolvedEnvironmentOptions(
config: ResolvedConfig,
): ResolvedEnvironmentOptions {
return {
define: config.define,
resolve: config.resolve,
consumer: 'server',
webCompatible: false,
dev: config.dev,
build: config.build,
}
}

Copy link
Member

Choose a reason for hiding this comment

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

I think it is better to move this one level up to /node/baseEnvironment so we don't need to include /server/ from build.ts

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense, done 👍

@patak-dev patak-dev merged commit a577828 into vitejs:main Sep 30, 2024
12 checks passed
@sapphi-red sapphi-red deleted the refactor/break-circular-deps branch September 30, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1-chore Doesn't change code behavior (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants