From 62b8dc60d1c56e99bad9ca742c203434994aa6a5 Mon Sep 17 00:00:00 2001 From: sebastienlorber Date: Fri, 29 Oct 2021 10:11:24 +0200 Subject: [PATCH 1/2] fix react-loadable types --- package.json | 1 - .../package.json | 1 - packages/docusaurus/package.json | 6 ++-- packages/docusaurus/src/webpack/base.ts | 3 -- .../src/webpack/sharedModuleAliases.ts | 19 ---------- yarn.lock | 36 ++++--------------- 6 files changed, 8 insertions(+), 58 deletions(-) delete mode 100644 packages/docusaurus/src/webpack/sharedModuleAliases.ts diff --git a/package.json b/package.json index 6b15bfe01308..3c905572d88b 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,6 @@ "@types/react": "^17.0.2", "@types/react-dev-utils": "^9.0.1", "@types/react-helmet": "^6.0.0", - "@types/react-loadable": "^5.5.3", "@types/react-router-config": "^5.0.1", "@types/react-test-renderer": "^17.0.1", "@types/semver": "^7.1.0", diff --git a/packages/docusaurus-module-type-aliases/package.json b/packages/docusaurus-module-type-aliases/package.json index bbc02b928a30..95f84ca18ada 100644 --- a/packages/docusaurus-module-type-aliases/package.json +++ b/packages/docusaurus-module-type-aliases/package.json @@ -14,7 +14,6 @@ "dependencies": { "@types/react": "*", "@types/react-helmet": "*", - "@types/react-loadable": "*", "@types/react-router-config": "*", "@types/react-router-dom": "*" }, diff --git a/packages/docusaurus/package.json b/packages/docusaurus/package.json index 1acdcc965e7b..4f932828b828 100644 --- a/packages/docusaurus/package.json +++ b/packages/docusaurus/package.json @@ -36,7 +36,6 @@ "@types/css-minimizer-webpack-plugin": "^3.0.2", "@types/detect-port": "^1.3.0", "@types/mini-css-extract-plugin": "^1.4.3", - "@types/module-alias": "^2.0.1", "@types/nprogress": "^0.2.0", "@types/react-dom": "^17.0.9", "@types/rtl-detect": "^1.0.0", @@ -56,7 +55,7 @@ "@babel/runtime-corejs3": "^7.15.4", "@babel/traverse": "^7.12.13", "@docusaurus/cssnano-preset": "2.0.0-beta.8", - "@docusaurus/react-loadable": "5.5.0", + "@docusaurus/react-loadable": "5.5.2", "@docusaurus/types": "2.0.0-beta.8", "@docusaurus/utils": "2.0.0-beta.8", "@docusaurus/utils-common": "2.0.0-beta.8", @@ -92,7 +91,6 @@ "leven": "^3.1.0", "lodash": "^4.17.20", "mini-css-extract-plugin": "^1.6.0", - "module-alias": "^2.2.2", "nprogress": "^0.2.0", "postcss": "^8.3.7", "postcss-loader": "^6.1.1", @@ -100,7 +98,7 @@ "react-dev-utils": "12.0.0-next.47", "react-error-overlay": "^6.0.9", "react-helmet": "^6.1.0", - "react-loadable": "^5.5.0", + "react-loadable": "npm:@docusaurus/react-loadable@5.5.2", "react-loadable-ssr-addon-v5-slorber": "^1.0.1", "react-router": "^5.2.0", "react-router-config": "^5.1.1", diff --git a/packages/docusaurus/src/webpack/base.ts b/packages/docusaurus/src/webpack/base.ts index 994238ace02c..cc2d4995e774 100644 --- a/packages/docusaurus/src/webpack/base.ts +++ b/packages/docusaurus/src/webpack/base.ts @@ -18,7 +18,6 @@ import { getMinimizer, } from './utils'; import {STATIC_DIR_NAME} from '../constants'; -import SharedModuleAliases from './sharedModuleAliases'; import {loadPluginsThemeAliases} from '../server/themes'; import {md5Hash} from '@docusaurus/utils'; @@ -149,8 +148,6 @@ export function createBaseConfig( process.cwd(), ], alias: { - ...SharedModuleAliases, - '@site': siteDir, '@generated': generatedFilesDir, diff --git a/packages/docusaurus/src/webpack/sharedModuleAliases.ts b/packages/docusaurus/src/webpack/sharedModuleAliases.ts deleted file mode 100644 index 84d8102e9bee..000000000000 --- a/packages/docusaurus/src/webpack/sharedModuleAliases.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import moduleAlias from 'module-alias'; - -// The shared module aliases are module aliases that need to work in both SSR/NodeJS + Webpack -const SharedModuleAliases = { - // Useful to fix the react-loadable warning - // See https://github.com/jamiebuilds/react-loadable/pull/213#issuecomment-778246548 - 'react-loadable': '@docusaurus/react-loadable', -}; - -moduleAlias.addAliases(SharedModuleAliases); - -export default SharedModuleAliases; diff --git a/yarn.lock b/yarn.lock index 93286effd8da..8d6cb20b9c87 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1327,11 +1327,12 @@ "@docsearch/css" "3.0.0-alpha.40" algoliasearch "^4.0.0" -"@docusaurus/react-loadable@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@docusaurus/react-loadable/-/react-loadable-5.5.0.tgz#6d6f0c8fd9a434b62a1ab1f8645ee7bde5a9ec21" - integrity sha512-Ld/kwUE6yATIOTLq3JCsWiTa/drisajwKqBQ2Rw6IcT+sFsKfYek8F2jSH8f68AT73xX97UehduZeCSlnuCBIg== +"@docusaurus/react-loadable@5.5.2", "react-loadable@npm:@docusaurus/react-loadable@5.5.2": + version "5.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce" + integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ== dependencies: + "@types/react" "*" prop-types "^15.6.2" "@docusaurus/responsive-loader@1.4.0": @@ -4306,11 +4307,6 @@ dependencies: "@types/node" "*" -"@types/module-alias@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@types/module-alias/-/module-alias-2.0.1.tgz#e5893236ce922152d57c5f3f978f764f4deeb45f" - integrity sha512-DN/CCT1HQG6HquBNJdLkvV+4v5l/oEuwOHUPLxI+Eub0NED+lk0YUfba04WGH90EINiUrNgClkNnwGmbICeWMQ== - "@types/node-fetch@^2.1.6": version "2.5.12" resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.12.tgz#8a6f779b1d4e60b7a57fb6fd48d84fb545b9cc66" @@ -4431,14 +4427,6 @@ dependencies: "@types/react" "*" -"@types/react-loadable@*", "@types/react-loadable@^5.5.3": - version "5.5.6" - resolved "https://registry.yarnpkg.com/@types/react-loadable/-/react-loadable-5.5.6.tgz#fcf6493d5015a4602672f3773a32032ce77fedea" - integrity sha512-2M7xH/wawZxNybbs/a76JkpUsMk4z6AxBh92cUtIBy2vK7EYYuitQbC4laY0hGz0e05R+mQ44YeHMtH2U+gMsw== - dependencies: - "@types/react" "*" - "@types/webpack" "^4" - "@types/react-router-config@*", "@types/react-router-config@^5.0.1": version "5.0.3" resolved "https://registry.yarnpkg.com/@types/react-router-config/-/react-router-config-5.0.3.tgz#72a53561bcb5e13b82c576527b818fa2579591c7" @@ -13894,11 +13882,6 @@ modify-values@^1.0.0: resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== -module-alias@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/module-alias/-/module-alias-2.2.2.tgz#151cdcecc24e25739ff0aa6e51e1c5716974c0e0" - integrity sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q== - module-definition@^3.3.0, module-definition@^3.3.1: version "3.3.1" resolved "https://registry.yarnpkg.com/module-definition/-/module-definition-3.3.1.tgz#fedef71667713e36988b93d0626a4fe7b35aebfc" @@ -16308,7 +16291,7 @@ promzard@^0.3.0: dependencies: read "1" -prop-types@^15.0.0, prop-types@^15.5.0, prop-types@^15.5.8, prop-types@^15.6.2, prop-types@^15.7.2: +prop-types@^15.0.0, prop-types@^15.5.8, prop-types@^15.6.2, prop-types@^15.7.2: version "15.7.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== @@ -16679,13 +16662,6 @@ react-loadable-ssr-addon-v5-slorber@^1.0.1: dependencies: "@babel/runtime" "^7.10.3" -react-loadable@^5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/react-loadable/-/react-loadable-5.5.0.tgz#582251679d3da86c32aae2c8e689c59f1196d8c4" - integrity sha512-C8Aui0ZpMd4KokxRdVAm2bQtI03k2RMRNzOB+IipV3yxFTSVICv7WoUr5L9ALB5BmKO1iHgZtWM8EvYG83otdg== - dependencies: - prop-types "^15.5.0" - react-router-config@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/react-router-config/-/react-router-config-5.1.1.tgz#0f4263d1a80c6b2dc7b9c1902c9526478194a988" From e4bb188b189ad270d36a53a743ca3924d2ac358f Mon Sep 17 00:00:00 2001 From: sebastienlorber Date: Fri, 29 Oct 2021 10:28:17 +0200 Subject: [PATCH 2/2] fix aliases snapshot --- .../src/webpack/__tests__/__snapshots__/base.test.ts.snap | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/docusaurus/src/webpack/__tests__/__snapshots__/base.test.ts.snap b/packages/docusaurus/src/webpack/__tests__/__snapshots__/base.test.ts.snap index 1fccb3f231ae..43d5b3c9083c 100644 --- a/packages/docusaurus/src/webpack/__tests__/__snapshots__/base.test.ts.snap +++ b/packages/docusaurus/src/webpack/__tests__/__snapshots__/base.test.ts.snap @@ -39,7 +39,6 @@ Object { "@theme/UserThemeComponent1": "src/theme/UserThemeComponent1.js", "@theme/subfolder/PluginThemeComponent2": "pluginThemeFolder/subfolder/PluginThemeComponent2.js", "@theme/subfolder/UserThemeComponent2": "src/theme/subfolder/UserThemeComponent2.js", - "react-loadable": "../../../../../../../@docusaurus/react-loadable", } `;