thc*_*ark 9 webpack raw-loader gatsby yarnpkg
我刚刚升级了 gatsby 2 -> 3。
\n在幕后,它现在使用 webpack 5 而不是 4,并且现在给出了一个突出的依赖项警告,我只是无法摆脱 -raw-loader作为主项目和 gatsby 的依赖项安装,即使它是相同的版本。
我尝试在 my 中指定纱线分辨率package.json,如下所示:
"resolutions": {\n "raw-loader": "4.0.2"\n },\nRun Code Online (Sandbox Code Playgroud)\n但这似乎没有任何作用。我也尝试过:
\n "resolutions": {\n "gatsby/raw-loader": "4.0.2"\n },\nRun Code Online (Sandbox Code Playgroud)\n\xe2\xa0\x99 Caching HTML renderer compilation\n<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Resolving \'raw-loader/dist/cjs\' in /Users/myname/source/octue/planex-site/node_modules/gatsby/node_modules/loader-runner/lib for build dependencies doesn\'t lead to expected result \'/Users/myname/source/octue/planex-site/node_modules/raw-loader/dist/cjs.js\', but to \'/Users/myname/source/octue/planex-site/node_modules/gatsby/node_modules/raw-loader/dist/cjs.js\' instead. Resolving dependencies are ignored for this path.\n<w> at unknown 4 raw-loader/dist/cjs\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/node_modules/loader-runner/lib/loadLoader.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/node_modules/loader-runner/lib/loadLoader.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/node_modules/loader-runner/lib/LoaderRunner.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/node_modules/loader-runner/lib/LoaderRunner.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/node_modules/webpack/lib/NormalModule.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/node_modules/webpack/lib/NormalModule.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/node_modules/webpack/lib/index.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/node_modules/webpack/lib/index.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/internal-plugins/functions/gatsby-node.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/internal-plugins/functions/gatsby-node.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/bootstrap/load-plugins/index.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/bootstrap/load-plugins/index.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/bootstrap/load-config-and-plugins.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/bootstrap/load-config-and-plugins.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/utils/worker/child/load-config-and-plugins.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/utils/worker/child/load-config-and-plugins.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/utils/worker/child/index.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/utils/worker/child/index.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby-worker/dist/index.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby-worker/dist/index.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/utils/worker/messaging.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/utils/worker/messaging.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/utils/jobs/worker-messaging.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/utils/jobs/worker-messaging.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/redux/actions/public.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/redux/actions/public.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/redux/actions/index.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/redux/actions/index.js\n<w> at file dependencies /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/utils/webpack.config.js\n<w> at file /Users/myname/source/octue/planex-site/node_modules/gatsby/dist/utils/webpack.config.js\nRun Code Online (Sandbox Code Playgroud)\nyarn why$ yarn why raw-loader\nyarn why v1.22.10\n[1/4] Why do we have the module "raw-loader"...?\n[2/4] Initialising dependency graph...\n[3/4] Finding dependency...\n[4/4] Calculating file sizes...\n=> Found "raw-loader@4.0.2"\ninfo Reasons this module exists\n - "gatsby" depends on it\n - Hoisted from "gatsby#raw-loader"\n - Hoisted from "@storybook#addon-docs#@storybook#builder-webpack4#raw-loader"\ninfo Disk size without dependencies: "32KB"\ninfo Disk size with unique dependencies: "240KB"\ninfo Disk size with transitive dependencies: "2.92MB"\ninfo Number of shared dependencies: 14\nRun Code Online (Sandbox Code Playgroud)\n如何正确配置 gatsby 或我的 package.json 或其他内容以正确解决此问题?
\n我发现的解决方法是:
rm -rf node_modules/gatsby/node_modules/raw-loader
Run Code Online (Sandbox Code Playgroud)
...这显然迫使节点只找到树顶部的单个依赖项。这消除了烦人的警告消息,但我真的很想正确解决这个问题。
我解决过的 gatsby github 上的一个密切相关的问题使我能够删除它,因为它与 webpack 依赖项有关。尽管如此,该解决方案需要兼容 gatsby 和 webpack 的解决方案,因此无论哪种方式,您都必须实际提供解决方案。
| 归档时间: |
|
| 查看次数: |
1938 次 |
| 最近记录: |