-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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(gatsby-plugin-mdx) for image import name collisions in mdx files #35028
fix(gatsby-plugin-mdx) for image import name collisions in mdx files #35028
Conversation
5ba17f2
to
b875961
Compare
a2fbcc6
to
7ba5a33
Compare
Fix lint errors but tests are still failing (I don't think that's because of any changes I made). |
…th same name across different files.
This commit allows importing files with the same import name across different files. Tries to be valid for `import pic from file.jpeg` or `import * as pic from file.jpeg` imports.
e6103e6
to
1ac268a
Compare
…s between identically named images. Model actual situation being fixed.
The files checked in now models the situation i see with our project. And if you check in the cache directory
Note the
``prettyImage_xxxxxxxx` imports show up twice above, because I manually patched the on-create-node.js file in the test directories node modules. But that brings up 2 issues.
@LekoArts Any way to fix these issues? |
The CI that runs your tests uses So you'd have in the root of the monorepo running:
And then inside
Then your local changes are copied over to the example project. |
Any word on this? |
Hey! Sorry for the silence here. MDX v2 is on the horizon: #25068 Please try those canaries out and if this still occurs there, comment on the discussion. Thanks! |
Ah. That is unfortunate as we don't have any need to move to MDX2 (currently), and the last time I tried I don't believe it was a seamless update (within gatsby). Perhaps we'll be able to try again in the future. Thanks for updating us on the progress though! |
This commit allows importing files with the same import name across different files.
Tries to be valid for
import pic from file.jpeg
orimport * as pic from file.jpeg
imports.Description
Given two files—file A located at
src/subdir1/file.mdx
and file B located atsrc/subdir2/file.mdx
— any imports with the same import name in both files will be 'compressed' to just one import: the last one.The changes introduced here make image imports across mdx files scoped to those specific files.
Documentation
Related Issues
Fixes closed issue #17119. Gives more runway for (in progress?) refactor of #25069 which is listed as target for providing a solution for 17119.