-
Notifications
You must be signed in to change notification settings - Fork 75
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
Getting error require() of ES modules is not supported error #16
Comments
Getting same error on macOS 12 |
try: import { browser } from '$app/env';
if (browser) {
// do browser stuff
} Should sort out that second error you got there. In the mean time, if anyone's got any clues for: WARN Local dependency not found at E:/KIT/kit/packages/kit
WARN Local dependency not found at E:/sites/packages/site-kit i.e. why the package.json file is: {
"devDependencies": {
"@sveltejs/kit": "link:..\\KIT\\kit\\packages\\kit",
},
"pnpm": {
"overrides": {
"@sveltejs/kit": "link:../../KIT/kit/packages/kit",
"@sveltejs/site-kit": "link:../../sites/packages/site-kit"
}
},
} lemme know. Edit: Yes, removing the overrides and specifying a recent version of svelte-kit worked for me, i.e. {
"devDependencies": {
"@sveltejs/kit": "^1.0.0-next.198",
}
} then running |
I ran into that too - guess those Anyway, I opened issue #19 asking him to document them in |
Cheers 👍 |
No. I'm using stackblitz for the time being. |
i dont have a solution yet but just went digging thru some github issues recently and found this: vitejs/vite#5197 so perhaps support is coming to vite although i was still not able to get it running on the default sveltekit. at this point if you are trying out svelte-cubed i recommend trying it out separately from sveltekit as the compounded alpha software-ness is self inflicting some problems here. start with this: https://github.com/sw-yx/svelte-cubed-starter or the REPL https://svelte.dev/repl/2200f07d5dc44843a0ecf15845cbe7b9?version=3.44.2 |
i don't know if it's the best solution, but i added the following to my const config = {
kit: {
vite: {
ssr: {
noExternal: ["three"]
}
}
}
}; I don't get the error anymore, tested with Sveltekit v1.0.0-next.201 |
@niklasgrewe Don't know either, but it gets rid of the error for me. Thank you very much! Thanks everyone for your feedback! @niklasgrewe I think it would be beneficial to include this solution/workaround in the svelte-cubed tutorial. Otherwise beginners like me are gonna be stumped on the very first step. I could open a PR integrating your solution into the tutorial. Let me know if You're cool with this! |
@Return180bpm glad to hear it works for you too. That is a very good idea. You are welcome to take my solution and create a PR 👍 |
Following the getting started tutorial as is causes a crash on the very first programming step for me and others - for details see issue Rich-Harris#16. This workaround seems to fix that. Solution suggested by @niklasgrewe in Rich-Harris#16 (comment) Fixes Rich-Harris#16
Node: 14.18.1

OS: WSL (Win 11)
The text was updated successfully, but these errors were encountered: