小编Lee*_*Hee的帖子

未找到主模块中的 WEBPACK5 错误:错误:无法解析“./src”

您只想使用 webpack5 分别构建 Express 和 gql 服务器相关的文件。
\n但是,构建时出现错误。

\n
\n

主错误
\n找不到模块:错误:无法解析'/Users/leedonghee/Dropbox/Project/observer/Homepage/v2/server 中的'./src'

\n
\n

我的文件在任何地方都不使用 ./src 。

\n

目录

\n
\n
server(root)\n\xe2\x94\x9c\xe2\x94\x80 dist\n\xe2\x94\x9c\xe2\x94\x80 model(mongoose & gql)\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80 schema.js\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80 main-sliders\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80 model.js\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80 resolver.js\n\xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80 schema.graphql\n\xe2\x94\x9c\xe2\x94\x80 node_modules\n\xe2\x94\x9c\xe2\x94\x80 index.js\n\xe2\x94\x9c\xe2\x94\x80 webpack.config.js\n\xe2\x94\x9c\xe2\x94\x80 .babelrc\n\xe2\x94\x9c\xe2\x94\x80 .env\n\xe2\x94\x9c\xe2\x94\x80 package.json\n\xe2\x94\x9c\xe2\x94\x80 package-lock.json\n\xe2\x94\x94\xe2\x94\x80 ...\n
Run Code Online (Sandbox Code Playgroud)\n

包.json

\n
\n
{\n  "name": "server",\n  "version": "1.0.0",\n  "description": "",\n  "private": true,\n  "scripts": {\n    "dev:server": "NODE_ENV=development nodemon --exec babel-node index.js",\n    "build": "webpack --mode production --progress",\n    "start:server": "NODE_ENV=production node ./build/index.js"\n  },\n  "keywords": [],\n  "author": "",\n …
Run Code Online (Sandbox Code Playgroud)

javascript node.js express webpack babeljs

6
推荐指数
1
解决办法
5293
查看次数

找不到模块:错误:无法解析“fs、net、path、util、os ...”

使用webpack打包时出现以下错误。

我按照错误描述的方法设置了,但是不知道问题出在哪里。

  • Express / apollo 服务器 / webpack5

错误


共有42个重复错误。

ERROR in ./node_modules/apollo-env/lib/utils/createHash.js 6:15-39
Module not found: Error: Can't resolve 'crypto' in '/Users/pj/v2/server/node_modules/apollo-env/lib/utils'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
        - install 'crypto-browserify'
If you …
Run Code Online (Sandbox Code Playgroud)

node.js express webpack apollo-server webpack-5

5
推荐指数
0
解决办法
3741
查看次数