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

fix(create): update broken SVG paths in templates #6762

Merged
merged 3 commits into from
Feb 26, 2022

Conversation

anicholls
Copy link
Contributor

Motivation

I recently tried a simple out-of-the-box setup of Docusaurus using the following script:

npx create-docusaurus@latest website classic --typescript --package-manager pnpm

This installed cleanly, but after starting or building the site I got the following errors:

Module not found: Error: Can't resolve '@site/src/static/img/undraw_docusaurus_mountain.svg' in '/Users/alex.nicholls/code/design/quantum/apps/website/src/components/HomepageFeatures'
Module not found: Error: Can't resolve '@site/src/static/img/undraw_docusaurus_tree.svg' in '/Users/alex.nicholls/code/design/quantum/apps/website/src/components/HomepageFeatures'
Module not found: Error: Can't resolve '@site/src/static/img/undraw_docusaurus_react.svg' in '/Users/alex.nicholls/code/design/quantum/apps/website/src/components/HomepageFeatures'

After inspection, it appeared that an unnecessary src/ had been put in the image src. The static/ folder in this example is in the root, not in src/, so removing this fixed the errors.

@facebook-github-bot
Copy link
Contributor

Hi @anicholls!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@netlify
Copy link

netlify bot commented Feb 25, 2022

✔️ [V2]
Built without sensitive environment variables

🔨 Explore the source changes: a51dbac

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/621997202a87f10007ce303f

😎 Browse the preview: https://deploy-preview-6762--docusaurus-2.netlify.app

@github-actions
Copy link

github-actions bot commented Feb 25, 2022

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 54
🟢 Accessibility 100
🟢 Best practices 92
🟢 SEO 100
🟢 PWA 90

Lighthouse ran on https://deploy-preview-6762--docusaurus-2.netlify.app/

@anicholls anicholls closed this Feb 25, 2022
@jakehemmerle
Copy link

jakehemmerle commented Feb 25, 2022

@anicholls why did you close this? I am also having the same issue 😄

@Josh-Cena Josh-Cena reopened this Feb 26, 2022
@Josh-Cena
Copy link
Collaborator

Yeah, no need to close—the CLA status gets updated automatically

@Josh-Cena Josh-Cena changed the title Update broken image URLs in typescript template example fix(create): update broken image URLs in typescript template Feb 26, 2022
@Josh-Cena Josh-Cena added the pr: bug fix This PR fixes a bug in a past release. label Feb 26, 2022
@jakehemmerle
Copy link

PR checks out; the patch solved the issue for me!

@Josh-Cena
Copy link
Collaborator

We should probably have a TypeScript E2E test as well... This template is currently untested

@anicholls
Copy link
Contributor Author

anicholls commented Feb 26, 2022 via email

@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Feb 26, 2022

Sorry! I found another, related issue that I wanted to address in the PR that I wasn't able to get to today.

I will directly update this PR. Did you get to sign the CLA? As long as you sign it, I will be able to merge your fix. I'd prefer if you can sign the CLA this weekend, because it's likely we do a hotfix release at the start of next week.

@Josh-Cena Josh-Cena changed the title fix(create): update broken image URLs in typescript template fix(create): update broken SVG paths in templates Feb 26, 2022
return (
<div className={clsx('col col--4')}>
<div className="text--center">
<img className={styles.featureSvg} alt={title} src={image} />
<Svg className={styles.featureSvg} role="img" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a side fix, because TypeScript correctly warns us that svg elements should not have alt. Instead, I've added a <title> to each SVG graphic. See also #6684

@Josh-Cena
Copy link
Collaborator

@anicholls Ping again, would you be able to sign the CLA this weekend? I hope to get this PR merged soon so I can add TS to the test matrix.

@anicholls
Copy link
Contributor Author

@Josh-Cena done! Thanks for jumping on this so quickly 🙏

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Feb 26, 2022
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@Josh-Cena
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants