Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

$lib imports in vanilla javascript with svelte / sveltekit

$
0
0

Is there any way to make statements like this work in vanilla javascript w/ svelte/sveltekit? I'm not using typescript. VS Code as my IDE.

import { googleAuth, auth } from '$lib/server/auth'

The error:

Relative import path "$lib/server/auth" not prefixed with / or ./ or ../ and not in import map from "file:///C:/dev/test/src/routes/auth/google/+server.js"deno(resolver-error)

I've tried:

  • ensuring $lib is in my svelte.config.js:
const config = {  kit: {    adapter: adapter(),    alias: {      $src: 'src',      $lib: 'src/lib',    }  },  preprocess: [vitePreprocess()]}
  • adding $lib to my jsconfig.json
{"extends": "./.svelte-kit/tsconfig.json","compilerOptions": {"allowJs": true,"checkJs": false,"moduleResolution": "bundler","baseUrl": ".","paths": {"$lib/*": ["./src/lib/*"]    }  }}

Neither work, sadly same error. Any ideas?


Viewing all articles
Browse latest Browse all 1541

Trending Articles