This works fine with the svelte-kit dev script but crashes svelte-kit build with the following error: [rollup-plugin-dynamic-import-variables] Unexpected token (6:265) which points to the line where I use the imported variable in a .svelte file. Any idea why?
Software hacker working in the industry since 2003. Currently loves: #Typescript and #Svelte. Founder of Chimera, the first makerspace in northern California.
It crashes for you on npm run build? It is working fine for me on a fresh SvelteKit project, maybe you can try from scratch to eliminate variables? Do you have a specific adapter you're using?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This works fine with the
svelte-kit dev
script but crashessvelte-kit build
with the following error:[rollup-plugin-dynamic-import-variables] Unexpected token (6:265)
which points to the line where I use the imported variable in a .svelte file. Any idea why?This is probably because your svelte component includes a style tag?
timdeschryver.dev/blog/environment...
That might have been it. I am now adding the env variables to
session
in a hook:That's smart!
some might still get errors like this even when applying Tim Deshryver's fix, apparently you cant just comment out old code that used this solution
It crashes for you on
npm run build
? It is working fine for me on a fresh SvelteKit project, maybe you can try from scratch to eliminate variables? Do you have a specific adapter you're using?