Hacker News new | ask | show | jobs
by nickstinemates 1099 days ago
Can someone point me to a concise location of getting a development environment setup for Docker.

Spent an hour or so after reading this and found conflicting information/out of date documentation. The tutorial[1] on the website is not helpful for actual deployment/development.

I found Svelte for New Developers[2] which is slightly better, however, when building according to the instructions what I expect to happen is not happening. i.e, a static index.html is rendered vs. the src/App.svelte getting rendered.

Wrangling all of this is the worst part of modern day Javascript.

1: https://learn.svelte.dev/tutorial/welcome-to-svelte 2: https://svelte.dev/blog/svelte-for-new-developers

1 comments

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)
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.