-
Notifications
You must be signed in to change notification settings - Fork 83
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
Update plugin for Docusaurus 2.0.0-beta.9+ (Webpack 5+, Node 16+, NPM 8+) #51
Conversation
- Replace `yarn.lock` with `package.lock`. - Update to the latest Docusaurus and React versions. - Modernize the Docusaurus config and Markdown sample files (some parameters, like `id` were deprecated). - Remove deprecated `routesLoaded` lifecycle function. - Address `useScrollPosition` et al. being moved to `@docusaurus/theme-common`. - Address `react-markdown` being significatly outdated by upgrading to v6 and adding `rehype` plugins as recommended. - Address significant Webpack 5 issues caused by removal of polyfills. - Resolve mismatched React and React-DOM version issues (which breaks SSR builds). - Resolve duplicate React/ReactDOM/Webpack issues (which generally breaks everything with almost ZERO useful diagnostic information).
This looks great! However, I haven't tested locally yet My main question is why the switch from yarn to npm?
After bumping the markdown package to 7.1.0, I no longer had the webpack process/path issues, but I think there was buffer issues from the DemoPanel |
Primarily since it's default with NodeJS installations so I imagine it has a wider audience. However, the real reason there's no
Yep, this is about right, I went down the list patching things out to determine it was |
In that case, can we revert the npm/yarn change? I can push commits to the PR to update the yarn.lock if you don't feel comfortable installing yarn. We can have a separate discussion about npm vs yarn going forward and open a new PR to make that change depending on what we decide. Otherwise, everything else looks good to me :) |
Sure.
Please do!
To be clear, I'm not entirely opposed to Yarn. I just suggest we support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally and looks good. There's a bit of an issue with the sidebar mobile support, but I think we can fix that in a separate PR
fixes: #31 |
The biggest issues with upgrading the plugin to the Docusaurus v2 betas comes from Webpack 5 and NPM v8 (as part of NodeJS v16+). What's upsetting is the fact that there's near ZERO useful diagnostic information whatsoever.
NOTE: You may need to replace
npm install
withnpm install --legacy-peer-deps
on npm 7+ CI/CD workflows beforenpm publish
ing.Notes
process
/Buffer
polyfills.react-markdown
depends onvfile
, which depends onpath
, which usesprocess.platform
without an import.buffer
andprocess
).--legacy-peer-deps
flag that needs to be applied tonpm install
before usingnpm link
for testing the library.npm ls @docusaurus/core
(^2.0.0-beta.9
),npm ls react
(^17.0.2
),npm ls react-dom
(^17.0.2
, MUST MATCHreact
VERSION), andnpm ls webpack
(^5.61.0
).docusaurus build
), a cryptic minified React error 321 supposedly indicates to the developer that hooks are not being implemented/used properly. DO NOT BELIEVE THIS ERROR - IT IS A RED HERRING!React
s or aReact
-React-DOM
mismatch.ProvidedDependency
class of ONE copy ofWebpack
is not serializable by a SEPARATE copy ofWebpack
(same version).node_modules
.Changelog
yarn.lock
withpackage.lock
.id
were deprecated).routesLoaded
lifecycle function.useScrollPosition
et al. being moved to@docusaurus/theme-common
.react-markdown
being significatly outdated by upgrading to v6 and addingrehype
plugins as recommended.