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

sveltekit vite import parse error '[plugin:vite:import-analysis] Failed to parse source for import because the content contains invalid JS syntax'

$
0
0

I tried to develop a generic $lib module for my new sveltekit project.

Getting this when trying to import a new module:

[plugin:vite:import-analysis] Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension./home/paul/dev/node/svelte-kit1/src/lib/load.js:1:11  |  export async function _load ({ fetch, params, url }) {   |  ^

This is of course untrue (?) export async etc. is valid JS.

I'm calling the import thus in a previously working page.js:

import { _load } from '$lib/load';/** @type {import('./$types').PageLoad} */export async function load ({ fetch, params }) {  let res = await fetch ('/api/estates');  etc...

If i remove this import from +page.js, the compile functions successfully, as it previously did.

I'm running a new and standard installation of sveltekit on debian 12 with node 18.19.0npm 9.2.0 and this package.json:

{"name": "svelte-kit1","version": "0.0.1","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","lint": "eslint ."},"devDependencies": {"@fontsource/fira-mono": "^4.5.10","@neoconfetti/svelte": "^1.0.0","@sveltejs/adapter-auto": "^3.0.0","@sveltejs/kit": "^2.0.0","@sveltejs/vite-plugin-svelte": "^3.0.0","@types/eslint": "^8.56.0","eslint": "^8.56.0","eslint-plugin-svelte": "^2.35.1","prisma": "^5.12.1","svelte": "^4.2.7","svelte-check": "^3.6.0","typescript": "^5.0.0","vite": "^5.0.3"},"type": "module","dependencies": {"@prisma/client": "^5.12.1","pg": "^8.11.5"}}

I haven't fiddled with any of the svelte or vite config.

What gives?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>