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: remove svgr/webpack from deps of new project #5703

Closed
wants to merge 1 commit into from

Conversation

lex111
Copy link
Contributor

@lex111 lex111 commented Oct 14, 2021

Motivation

I don't really understand why svgr/webpack dependency is added right now when initializing new project, since it already used in the core package, so why duplicate it then?

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Test release.

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@lex111 lex111 added the pr: maintenance This PR does not produce any behavior differences to end users when upgrading. label Oct 14, 2021
@lex111 lex111 requested a review from slorber as a code owner October 14, 2021 08:10
@netlify
Copy link

netlify bot commented Oct 14, 2021

✔️ [V2]

🔨 Explore the source changes: 5f4bcc7

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

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

@github-actions
Copy link

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 78
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

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

@github-actions
Copy link

Size Change: -4 B (0%)

Total Size: 841 kB

ℹ️ View Unchanged
Filename Size Change
website/.docusaurus/globalData.json 38.3 kB 0 B
website/build/assets/css/styles.********.css 93.7 kB 0 B
website/build/assets/js/main.********.js 425 kB 0 B
website/build/blog/2017/12/14/introducing-docusaurus/index.html 67.2 kB 0 B
website/build/blog/index.html 38.1 kB 0 B
website/build/docs/index.html 45 kB -2 B (0%)
website/build/docs/installation/index.html 53.6 kB -2 B (0%)
website/build/index.html 30.8 kB 0 B
website/build/tests/docs/index.html 26.2 kB 0 B
website/build/tests/docs/standalone/index.html 22.9 kB 0 B

compressed-size-action

@slorber
Copy link
Collaborator

slorber commented Oct 14, 2021

Yarn 3 PnP mode 🤪

Module not found: Error: Can't resolve '@svgr/webpack' in '/home/runner/work/docusaurus/test-website'

It is more strict about deps, and it is needed to be able to use require('../../static/img/undraw_docusaurus_mountain.svg')

Code in site can only use deps declared by site.

I'd also like to remove file-loader in the future

Should be solved by migrating to Webpack assets, but not sure how to do that properly yet: #4708

@lex111
Copy link
Contributor Author

lex111 commented Oct 14, 2021

Thanks for the explanation, alright, let's wait then..

FYI, new version of svgr is released (https://github.com/gregberge/svgr/commits/main), although it is alpha version, in theory we can used it for now, or PnP will prevent this?

Also updating to new version of svgr should fix this warning:

warning @docusaurus/core > @svgr/webpack > @svgr/plugin-svgo > svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.

@slorber
Copy link
Collaborator

slorber commented Oct 14, 2021

I'm not a PnP expert 😅

image

I'd rather wait a bit for more usage/bugfixes before adopting that alpha release

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Oct 14, 2021
ludofischer added a commit to ludofischer/docusaurus that referenced this pull request Nov 16, 2021
* changelog https://github.com/gregberge/svgr/releases
* SVGO 2 changelogg https://github.com/svg/svgo/releases/tag/v2.0.0
* depend on maintained svgo version
* although svgr 6 is in alpha, it fixes a few issues
  with webpack 5 (gregberge/svgr@1a8cc98)
  and React (gregberge/svgr@3700aba)
* see also facebook#5703
ludofischer added a commit to ludofischer/docusaurus that referenced this pull request Nov 16, 2021
* svgr changelog https://github.com/gregberge/svgr/releases
* SVGO 2 changelog https://github.com/svg/svgo/releases/tag/v2.0.0
* depend on maintained svgo version
* although svgr 6 is in alpha, it fixes a few issues
  with webpack 5 (gregberge/svgr@1a8cc98)
  and React (gregberge/svgr@3700aba)
* see also facebook#5703
Josh-Cena added a commit that referenced this pull request Nov 29, 2021
* chore: update @svgr/webpack to version 6

* svgr changelog https://github.com/gregberge/svgr/releases
* SVGO 2 changelog https://github.com/svg/svgo/releases/tag/v2.0.0
* depend on maintained svgo version
* although svgr 6 is in alpha, it fixes a few issues
  with webpack 5 (gregberge/svgr@1a8cc98)
  and React (gregberge/svgr@3700aba)
* see also #5703

* Fix config

* fix e2e test

* Fix again

* Update to stable

Co-authored-by: Josh-Cena <sidachen2003@gmail.com>
@Josh-Cena
Copy link
Collaborator

Closing in favor of #6047. We just need to load these loaders with require.resolve

@Josh-Cena Josh-Cena closed this Dec 6, 2021
@lex111 lex111 deleted the lex111/svgr-dep branch December 7, 2021 14:16
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: maintenance This PR does not produce any behavior differences to end users when upgrading.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants