svelte-loading-spinners icon indicating copy to clipboard operation
svelte-loading-spinners copied to clipboard

Error of Unknown file extension ".svelte" in SvelteKit

Open Gutza opened this issue 1 year ago • 13 comments

Using SvelteKit with Typescript, and I received the error in the title immediately upon importing the Circle.

This fixed it: https://github.com/hperrin/svelte-material-ui/issues/375#issuecomment-991419187

Gutza avatar May 25 '23 16:05 Gutza

How do you deal with it? Simply inserting those lines into the package.json of svelte-loading-spinners didn't change anything for me.

ulfaslak avatar Aug 13 '23 18:08 ulfaslak

I have the same issue. Are there any fixes before library update? screenshot

dmdin avatar Aug 14 '23 12:08 dmdin

So the simple "fix" is that if you only need a few kind of spinners, you can simply copy the components into your project $lib/components and just import them from there. Bit of a sad hack but it works.

ulfaslak avatar Aug 14 '23 18:08 ulfaslak

@Schum123 Any news on this ? Thanks

KaKi87 avatar Aug 21 '23 16:08 KaKi87

I will fix this. Hopefully this week.

Schum123 avatar Aug 22 '23 07:08 Schum123

I just tried this using latest SvelteKit and it works for me.

Schum123 avatar Aug 23 '23 11:08 Schum123

Yet it didn't for me, that's precisely why I asked. Thanks

KaKi87 avatar Aug 23 '23 13:08 KaKi87

@KaKi87 Could you send me you package.json?

Schum123 avatar Aug 23 '23 13:08 Schum123

Hello, I am getting this error as well.

Here is my package config: { "name": "x", "version": "0.0.1", "private": true, "scripts": { "dev": "vite dev", "build": "vite build", "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch" }, "devDependencies": { "@sveltejs/adapter-auto": "^2.0.0", "@sveltejs/kit": "^1.20.4", "prettier": "^3.0.2", "prettier-plugin-svelte": "^3.0.3", "svelte": "^4.0.5", "svelte-check": "^3.4.3", "svelte-loading-spinners": "^0.3.4", "typescript": "^5.0.0", "vite": "^4.4.2" }, "type": "module" }

w3rafu avatar Aug 26 '23 15:08 w3rafu

Getting this same issue...

5:10:56 PM [vite] Error when evaluating SSR module /src/routes/+page.svelte: failed to import "svelte-loading-spinners"
|- TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".svelte" for D:\Webstorm_projects\project\node_modules\svelte-loading-spinners\Circle.svelte

Internal server error: Unknown file extension ".svelte" for D:\Webstorm_projects\project\node_modules\svelte-loading-spinners\Circle.svelte { code: 'ERR_UNKNOWN_FILE_EXTENSION' }

Rdk1229 avatar Sep 22 '23 22:09 Rdk1229

I got it working by just manually creating the component file I wanted, type file, and utils.ts file in my project.

sirbots avatar Oct 14 '23 18:10 sirbots

Instead of this:

import { Circle } from 'svelte-loading-spinners';

use this:

import Circle from 'svelte-loading-spinners/Circle.svelte';

Tichss avatar Nov 13 '23 10:11 Tichss