首页 > 解决方案 > 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);

标签: reactjscreate-react-app

解决方案


推荐阅读