首页 > 解决方案 > readFileSync error occurs when to read yaml file

问题描述

I'm trying to read a yaml file with Type Script. But I get an error of readFileSync and cannot read it. What should I do?

fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFileSync is not a function

import fs from 'fs'
import yaml from 'js-yaml'

export const en = yaml.safeLoad(fs.readFileSync('./en.yml', 'utf8'))

标签: typescriptyaml

解决方案


推荐阅读