sveltejs / template-webpack

Template for building basic Svelte applications with webpack
300 stars 118 forks source link

webpack-dev-server cant open non primary url #49

Open alishi973 opened 2 years ago

alishi973 commented 2 years ago

Describe the Bug:

Recently I tried to create a simple web application with svelte (and especially with this webpack template) But when I added svelte-navigator and used history API, this problem happened to me: Cannot GET /XYZ

Reproduction:

First clone and install dependencies:

git clone https://github.com/alishi973/webpack-svelte-devserver-routing
cd webpack-svelte-devserver-routing
yarn // or npm install

then open Login Page and use the Go to register Link (or you can manually type /register) and finally, refresh the page and the problem accured.

Expected Behavior:

Open register page normally! this is annoying during development to go on the primary route and then try to reach some page after a hard refresh

Conduitry commented 2 years ago

To align with the Rollup template (https://github.com/sveltejs/template/#single-page-app-mode) we shouldn't add this as a default, specifically because it would only affect dev mode, leading people to not be aware of the necessary server configuration until they were already in production. This conversation has come up several times in the Rollup template.

It would probably be worthwhile to put a similar section in this template's readme, though, directing people to edit the appropriate configuration if they do need SPA behavior.