docusaurus-plugin-fix-react
v1.0.7
Published
Fixes the issue when npm package / exported Component uses React import, so webpack resolves it not from global node_modules/react but instead from package directory, which causes Hooks and other parts of React not working properly.
Downloads
3
Maintainers
Readme
docusaurus-plugin-fix-react
Fixes the issue when npm package / exported Component uses React import, so webpack resolves it not from global node_modules/react but instead from package directory, which causes Hooks and other parts of React not working properly.
Installation:
## NPM
npm i docusaurus-plugin-fix-react
## yarn
yarn add docusaurus-plugin-fix-react
## PNPM
pnpm add docusaurus-plugin-fix-react
Add to your docusaurus.config.js:
/** @type {import('@docusaurus/types').Config} */
const config = {
plugins: ["docusaurus-plugin-fix-react"],
// ... rest of the config
}
~ or, alternatively:
/** @type {import('@docusaurus/types').Config} */
const config = {
plugins: ["./node_modules/docusaurus-plugin-fix-react/index.js"],
// ... rest of the config
}
If you use PNPM and @type errors appear this may help:
# add next line to your .npmrc file
node-linker=hoisted
License
MIT © Patryk Jaworski