Getting an issue while integrating google-cloud with webpack
我正在将google-cloud npm软件包与我的react应用程序集成在一起,并且我正在使用Firebase。
我遇到的错误-
WARNING in ./~/google-cloud/~/hash-stream-validation/index.js Module
not found: Error: Can't resolve 'fast-crc32c' in
'/home/linuxbox/React-Workspace/Kaptify/node_modules/google-cloud/node_modules/hash-stream-validation'
@ ./~/google-cloud/~/hash-stream-validation/index.js 5:8-30 @
./~/google-cloud/~/@google-cloud/storage/src/file.js @
./~/google-cloud/~/@google-cloud/storage/src/index.js @
./~/google-cloud/src/index.js @ ./src/actions/UserStateStore.js @
./app.js @ multi (webpack)-dev-server/client?http://127.0.0.1:3000
webpack/hot/dev-server ./app.jsWARNING in ./~/google-cloud/~/google-auto-auth/index.js 53:13-58
Critical dependency: the request of a dependency is an expressionWARNING in ./~/google-cloud/~/grpc/src/node/src/grpc_extension.js
38:14-35 Critical dependency: the request of a dependency is an
expressionWARNING in ./~/google-cloud/~/node-pre-gyp/lib/pre-binding.js 19:22-48
Critical dependency: the request of a dependency is an expressionWARNING in ./~/google-cloud/~/node-pre-gyp/lib/util/versioning.js
15:20-67 Critical dependency: the request of a dependency is an
expression
有人可以帮我解决这个问题吗?
我看到您正在使用webpack,并且我假设您正在后端使用
尝试将其放入您的webpack配置中:
1 2 3 4 5 6 7 | config = { // ... externals: { '@google-cloud/storage': 'commonjs @google-cloud/storage' }, // ... } |
解释
用于后端的模块并不是真正为了捆绑在一起而设计的(请参阅:带有Webpack的后端应用程序)。因此,我们使用webpack的
如果您不想一一指定问题模块,请尝试使用webpack-node-externals自动排除所有模块。