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

chore: @babel/plugin-transform-react-jsx Add dependency #38544

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ryong-E
Copy link

@Ryong-E Ryong-E commented Sep 12, 2023

Adding package dependencies with @babel/plugin-transform-react-jsx dependency error when using yarnberry.

Description

In the yarnrc.yml file

packageExtensions: {
gatsby@*: {
dependencies: {
"@babel/plugin-transform-react-jsx": ^7.22.15
}
}
}

Fixed an issue (#38543) that occurred by adding syntax.
So I added a dependency to the gatsby package.

The test was done by modifying the yarnrc.yml file in the yarnberry environment.
I don't know how to modify open source like this and test in yarnberry pnp environment.

Documentation

Tests

Related Issues

#38543

Adding package dependencies with @babel/plugin-transform-react-jsx dependency error when using yarnberry.
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 12, 2023
@pieh
Copy link
Contributor

pieh commented Jan 3, 2024

This is not correct fix - error happens because of

babel.createConfigItem([resolve(plugin.name), plugin.options], {
(and same in line 179), because resolve used there is from gatsby context. You are adding this in your own code, so really the plugin.name should be resolved when using setBabelPlugin / setBabelPreset (right now gatsby doesn't do it and that is something to fix, but you can workaround it by doing what I mentioned in #38543 (comment)

@babel/plugin-transform-react-jsx is already installed as part of gatsby (part of @babel/preset-react, which is part of babel-preset-gatsby), so there should be no need to set it yourself? so possibly you could drop this entire setBabelPlugin in your site as it shouldn't actually do anything (unless it's version thing).

We should not be adding this dependency to gatsby just so people could manually use it themselves.

We can likely add failing test case for our pnp tests by adding custom babel plugins to reproduce the issue you are having and then maybe look to fix it properly.

@pieh pieh added topic: webpack/babel Webpack or babel and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: webpack/babel Webpack or babel
2 participants