gyurielf/svelte-tel-input

Problem with unknown file extension '.svelte'

Closed this issue · 7 comments

While trying to use this package for my project, I noticed that when I refreshed a page that had the , it would generate a svelte error
I googled my way around and found that to fix the issue, the package.json for this package(svelte-tel-input), had to include a svelte field. I tried it and it worked, so if anyone else has this issue and is stuck on it, try that solution.

Follow this link for more on the problem

Hey!

Thanks for the report.

Can you provide more information about the tooling what you use. Normally you shouldn't meet with this issue. Since it's exported in the root.

"svelte": "./dist/index.js",

This will be a PR which adds the old way back.
#186

Am guessing that by tooling you mean whether I use npm or yarn, right? I used npm.

Yes, partly.
Would be nice to know what svelte version are you using?
Do you use it in svelte-kit?
What IDE are you using?

I just want to reproduce this problem to understand and solve it properly.
Thanks!

having this problem using npm and node 21

Unknown file extension ".svelte" for /Users/raphael/dev/mono_sweif/node_modules/svelte-tel-input/dist/components/input/TelInput.svelte

I tried with pnpm and it worked fine though.

@gyurielf here is a bit more of the error displlayed

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".svelte" for /Users/raphael/dev/mono_sweif/node_modules/svelte-tel-input/dist/components/input/TelInput.svelte
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:160:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:203:36)
    at defaultLoad (node:internal/modules/esm/load:141:22)
    at async ModuleLoader.load (node:internal/modules/esm/loader:409:7)
    at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:291:45

not sure if it helps. I'm on the latest version of the modules.

I get the following warning in vite

 [vite-plugin-svelte] WARNING: The following packages use a svelte resolve c
onfiguration in package.json that has conflicting results and is going to cause problems future.

svelte-select@5.7.0
svelte-tel-input@3.3.8

Please see https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/faq.md#conflicts-in-svelte-resolve for details.

but the link says nothing.

I've got some more information, this is only a problem in dev, when actually building, this works no problem, this makes me think the problem is with vite-plugin-svelte