为什么当我将 `@googleapis/docs` 添加到我的项目时会出现 webpack 错误?

问题描述 投票:0回答:1

当我添加以下内容时...

import {docs} from "@googleapis/docs";
"@googleapis/docs": "^3.0.2",

我得到以下信息

Module not found: Error: Can't resolve 'buffer' in '/Users/jackiegleason/Code/personal/jrg-ui/node_modules/buffer-equal-constant-time'
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: { "buffer": require.resolve("buffer/") }'
        - install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "buffer": false }

我很困惑它要求我做什么。我正在使用

react-scripts
所以它将处理 webpack 我没有特定的配置文件。

node.js npm webpack google-docs-api
1个回答
0
投票

具体针对缓冲区问题,您有以下几种选择:

但是这些都不能解决你所有的问题。

@googleapis/docs
旨在从 Node 使用,它不是客户端库。

© www.soinside.com 2019 - 2024. All rights reserved.