reactjs - fs.existsSync 不是 create-react-app 项目中的函数?
问题描述
Unhandled Rejection (TypeError): fs__WEBPACK_IMPORTED_MODULE_0__.existsSync is not a function
我有一个使用 create-react-app 创建的项目,当我调用 fs 模块中的方法时,它会引发错误。
import * as fs from "fs"
const doesPathExist = fs.existsSync(this.inputPath);
解决方案
推荐阅读
- json - 如何在脚本/SSM 文档中添加自定义答案?
- neo4j - Cypher - 订购前的不同结果
- reactjs - 有没有办法在 eslint 或 vscode 中自动导入模块?
- ios - 找不到与提供的目的地说明符匹配的目的地
- python - 获取与 Outlook 格式相同的 Outlook 电子邮件 [使用 python]
- c++ - 这是将graphviz用作库的正确方法吗?
- python - 如何使用 Tensorflow 2/Keras 保存和恢复训练具有多个模型部分的 GAN
- python - 无法交互列表
- javascript - 仅当它与 $auth 和 vuejs (nuxt) 一起存在时才显示信息
- python - 如何匹配语句中的变量?