Svelte 5/SvelteKit中svelte-filepond模块找不到误报求助
SvelteKit中svelte-filepond依赖缺失的误报问题
环境栈:Svelte 5 / SvelteKit / Filepond
在我的SvelteKit应用中,出现了svelte-filepond依赖缺失的误报。我在自定义Svelte组件中按如下方式导入:
import FilePond, { registerPlugin } from 'svelte-filepond';
报错信息:
Error: Cannot find module 'svelte-filepond' or its corresponding type declarations
尽管存在该错误警告,Filepond在应用中仍能正常显示并工作。
package.json 配置
"dependencies": { "filepond": "^4.31.1", "filepond-plugin-image-exif-orientation": "^1.0.11", "filepond-plugin-image-preview": "^4.6.12", "svelte-filepond": "^0.2.2", }
tsconfig.json 配置
{ "extends": "./.svelte-kit/tsconfig.json", "compilerOptions": { "allowJs": true, "checkJs": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, "skipLibCheck": true, "sourceMap": true, "strict": true, "moduleResolution": "bundler" }, }
vite.config.js 配置
export default defineConfig({ plugins: [sveltekit()], test: { include: ['src/**/*.{test,spec}.{js,ts}'] } });
svelte.config.js 配置
/** @type {import('@sveltejs/kit').Config} */ const config = { preprocess: vitePreprocess(), kit: { adapter: adapter() } }; export default config;
已尝试的解决方法
- 删除
node_modules和.svelte-kit文件夹后重新安装依赖 - 执行
npm check - 执行
npm build
临时解决方法
目前已添加// @ts-ignore来忽略该错误提示。
内容的提问来源于stack exchange,提问作者NickyLarson
相关产品推荐
相关产品推荐

