swiper + ts 类型报错
"swiper": "^9.4.1" 版本号
修改 tsconfig.json 文件下面的 moduleResolution 为node
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": [
"src/*"
]
},
"target": "ES2020",
"useDefineForClassFields": true,
"lib": [
"ES2020",
"DOM",
"DOM.Iterable"
],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode 类型报错在这里*/
"moduleResolution": "node",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"typeRoots": [
"./typings",
"./node_modules/@types"
]
},
"include": [
"src",
"typings/**/*.ts"
],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}
标签:node,ts,报错,swiper,true,moduleResolution
From: https://www.cnblogs.com/sjie/p/17585665.html