如何在ReactApp中加载js-yaml包?
看起来当我通过npm安装它时,它被添加到package.json
"dependencies": {
"googleapis": "^31.0.2",
"react": "^16.4.0",
"react-dom": "^16.4.0",
"react-scripts": "1.1.4",
"yaml-js": "^0.2.3"
},
但是当我尝试在我的代码中运行yaml.load
时,我收到了错误
./src/App.js
Line 56: 'yaml' is not defined no-undef
答案 0 :(得分:2)
以下工作
import yaml from 'yaml-js';