Hacker News new | ask | show | jobs
by pcthrowaway 1098 days ago
I can't help you with a docker setup, but if I'd highly recommend Vite for standing up a working Svelte dev environment (or Sveltekit, or React, or Next for that matter): https://vitejs.dev/guide/

You'll be up and running in seconds. This is all you need to know:

    # npm 6.x
    npm create vite@latest my-svelte-app --template svelte

    # npm 7+, extra double-dash is needed:
    npm create vite@latest my-svelte-app -- --template svelte
(if you're looking for sveltekit it's the same command, you'll just select sveltekit in the prompt)
1 comments

I did this - that's part of the 2nd link. Problem is that it didn't work for me. I definitely did something wrong.
Did you use the right command for your npm version? Did the installer work? Or did something go wrong with `npm run dev`?
Yes, installer worked. npm run dev resulted in a generated index.html not the contents of src/app/App.svelte
npm run dev should start the dev server with a page that hot reloads when you make changes in the App.svelte. You selected Svelte and not Sveltekit?

I just went through it and there's an important step of changing into the directory created by `npm create ...` (named `my-svelte-app` in the example above) and then running `npm install` inside that directory.

Can confirm it works for me with npm version 8.5.5, node v15.15.0, on a macbook air with an Intel processor.

    npm create vite@latest my-svelte-app -- --template svelt
    cd my-svelte-app/
    npm install
    npm run dev
Started up the dev server, made a change in the App.svelte, and could see it reflected in the browser immediately.