【发布时间】:2018-12-17 22:15:41
【问题描述】:
安装 node-config 和 @types/config 后:
npm install config
npm install @types/config
当我尝试在我的应用中使用时:
import config from 'config';
我收到错误:
Module not found: Error: Can't resolve 'fs'
我安装了'fs' 模块,但仍然出现此错误。
Module not found: Error: Can't resolve 'fs'
【问题讨论】:
-
你能把代码贴在你试图访问'fs'的地方吗?
-
所以,我只是想在我的 ts 文件中使用模块配置,例如 import * as cfg from "config" export interface configuration { appId: string, src: string, version string; } 导出 const facebook 配置:配置 = cfg.get ("cfg");并收到此错误,但如果您打开 config.The JS 文件,我会看到以下代码: // Dependences var Yaml = null, // 外部库是延迟加载的 VisionmediaYaml = null, // 仅当这些文件类型存在时。 ... 文件系统 = 要求('fs');
标签: reactjs typescript2.0 node-config