-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SvelteKit v1.0.0-next.146 SyntaxError: Cannot use import statement outside a module #2161
Comments
Thank you for the report! I will file an issue with Vite and try to figure out what's going on. In the meantime you can work around this and go back to the old behavior with:
Next time could you add the reproduction to a git repo? 😉 |
That workaround fixed the error above but there is another fatal error in the browser in my (big) project. Sorry, I cannot re-produce it in a small example. Production build work fine though. PS. I will stay with 144 for a while... |
That turned out to be caused by Sveltestrap. I sent a fix here: bestguy/sveltestrap#356 Please do try to find a way to reproduce the other error you're having or some way to share with me. The code isn't going back to the way it was 😄 So otherwise you'll be stuck on an old version forever... |
I think I found it in short this is the code <script>
import Icon from 'svelte-awesome';
import { spinner as mySpinner} from 'svelte-awesome/icons';
</script>
<h1>Header</h1>
<hr />
<slot /> |
I just did |
Sorry, I didn't mention it, PS. I renamed it in repo that you can see the error in browser |
A workaround import mySpinner from 'svelte-awesome/icons/spinner.js'; |
I have the same issue when I start a new demo project.
And here is the repo that has the problem: https://github.com/tcoopman/sveltekit-repro-bug-vscode To be clear, |
@benmccann I am seeing this error again after updating to 1.0.0-next.304 |
@lovasoa can you file a new issue with a reproduction? I don't have a way to reproduce and investigate at the moment |
@benmccann sorry for issue hijacking, but this happens to me too. this is my open issue #4603 thank you |
If someone's still facing this issue after upgrading svelteKit version to |
Hey, configuring the option within svelte.config.js is no longer supported as all vite configurations need to go in vite.config.js (when I added |
@ethanmichel0 Same issue, but I found this bestguy/sveltestrap#463 (comment) works. Add |
on vite.config.js, inside the config variable, add something like this:
at least this works for me |
My vite.config.ts looks like this:
Where do I insert your example, @ahmadshiddiqn? Do I insert EDIT: Yep, that seemed to work. Thanks for the tip! |
AFAIK, the order doesn’t matter, it would act like a JSON obj. But my vite.config.ts on my other sveltekit project looks something like this: import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()],
ssr: {
noExternal: ['@popperjs/core', 'chart.js', 'svelte-select', 'svelte-gantt']
}
}); |
Describe the bug
After upgrade to SvelteKit v1.0.0-next.146 (from 144)
Getting the error in both dev & prod
Reproduction
cd /tmp
npm init svelte@next ttt
all defaults
cd ttt
rm -rf src/routes/*
npm install
npm install sveltestrap @sveltejs/adapter-node@next
src/routes/index.svelte
:svelte.config.js
:Logs
System Info
Severity
blocking an upgrade
Additional Information
It works fine in SvelteKit v1.0.0-next.144
The text was updated successfully, but these errors were encountered: