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

feat: support resolve.alias per environment in Environment API #17583

Open
wants to merge 1 commit into
base: v6/environment-api
Choose a base branch
from

Conversation

lazarv
Copy link

@lazarv lazarv commented Jun 27, 2024

Description

This PR implements the suggested solution in #17582 and adds a test playground named environment-alias to check that the new alias plugin is using the resolve.alias specified per environment.

Copy link

stackblitz bot commented Jun 27, 2024

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

@patak-dev
Copy link
Member

There are errors because the formatter wasn't run. It should be automatic when you commit. But you can run it manually if not.

We have a lot of playgrounds already, so we should try to avoid new ones as much as possible. Maybe you could try adding the test to the environment-react-ssr playground? Maybe later on we can have a more generic one for these tests.

@@ -40,7 +40,7 @@ export function createIdResolver(
pluginContainer = await createEnvironmentPluginContainer(
environment as Environment,
[
aliasPlugin({ entries: config.resolve.alias }), // TODO: resolve.alias per environment?
aliasPlugin({ entries: config.resolve.alias }),
Copy link
Member

Choose a reason for hiding this comment

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

This should be environment.options.resolve.alias, the config has the default values. We were thinking that we should deprecate these defaults on the ResolvedConfig and remove them later to avoid these issues.

Copy link
Author

Choose a reason for hiding this comment

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

I kept this as a fallback and collecting the environment specific resolve.alias in the plugin, but if it's not needed, I can change this to pass it directly. Makes total sense as this part is creating a plugin container for the environment.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see the new alias plugin. I think we don't need it. We can use the option here and keep everything else as is.

@lazarv
Copy link
Author

lazarv commented Jun 30, 2024

There are errors because the formatter wasn't run. It should be automatic when you commit. But you can run it manually if not.

I only see that the deadlock test is failing, which was failing before my changes too and also locally, but I will re-check the formatter.

We have a lot of playgrounds already, so we should try to avoid new ones as much as possible. Maybe you could try adding the test to the environment-react-ssr playground? Maybe later on we can have a more generic one for these tests.

I will give it a go, probably I can integrate these tests into that playground.

@lazarv
Copy link
Author

lazarv commented Jun 30, 2024

Re-run pnpm format, but no new changes. Could you please give me a link to the error?

@patak-dev
Copy link
Member

Re-run pnpm format, but no new changes. Could you please give me a link to the error?

Ah, sorry for the noise. Format is ok, nvm that.

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