Vue 中 ts 添加 fs 报错: Cannot find module ‘fs‘
Vue 中 ts 添加 fs 报错: Cannot find module 'fs'1. 添加依赖2. 修改 tsconfig.json 配置文件1. 添加依赖npm i --save-dev @types/node2. 修改 tsconfig.json 配置文件{"compilerOptions": {"target": "esnext","module": "esnext","strict":
·
Vue 中 ts 添加 fs 报错: Cannot find module 'fs'
1. 添加依赖
npm i --save-dev @types/node
2. 修改 tsconfig.json 配置文件
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env",
"mocha",
"chai",
"node"
],
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
],
"typeRoots": [
"node_modules/@types"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
]
}
更多推荐
已为社区贡献1条内容
所有评论(0)