当我尝试在节点应用程序中使用mongoose connect时,Webpack会抛出以下错误.
最初还有一些错误,比如,
Module not found: Error: Cannot resolve module 'fs'
Run Code Online (Sandbox Code Playgroud)
在我的webpack配置文件中进行以下更改就可以了,
我在webpack配置文件中添加了node-loader和node对象.
node:{console:'empty',fs:'empty',net:'empty',tls:'empty'},
但是波纹管错误仍然存在.知道怎么解决吗?
WARNING in ./~/mongoose/~/mongodb/~/mongodb-core/~/require_optional/index.js
Critical dependencies:
63:18-42 the request of a dependency is an expression
71:20-44 the request of a dependency is an expression
78:35-67 the request of a dependency is an expression
@ ./~/mongoose/~/mongodb/~/mongodb-core/~/require_optional/index.js 63:18-42 71:20-44 78:35-67
WARNING in ./~/mongoose/~/mongodb/~/mongodb-core/~/require_optional/README.md
Module parse failed: /Users/nitesh/Documents/learnReact/day1/r3-foundation-boilerplate/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/require_optional/README.md Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '#' (1:0)
at …
Run Code Online (Sandbox Code Playgroud)