johnpapa / johnpapa/lite-server

Style sheets not loaded from correct location when refreshing page with more than one path in URL

Open
#96 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.3k
Forks
262
PR merge metrics
No merged PRs in 30d

Description

I have noticed that when doing a page refresh for an Angular2 app with a route that is deeper than one path
e.g. http://localhost:3000/customer/detail

the CSS files are not loaded. The developer tools indicate that the server is attempting to load them from the child path, instead of from the root path
i.e. server uses path: http://localhost:3000/customer/detail/styles.css
but the correct path should be: http://localhost:3000/styles.css

I have attached a zip file containing a small Angular2 app that exhibits the behaviour.
### Repro steps
1. Run "npm start"
2. From the root page, refresh and notice the style sheet is loaded correctly.
3. Change the URL to customers/2
4. Notice the page is loaded correctly
5. Press F5 to reload the page
6. The style sheet is being loaded from the wrong location.
### Environment
- `lite-server` version: 222
- `nodejs` version: 4.4.7
- `npm` version: 3.4.0
- OS type/version: Windows 10 Enterprise
[ng2-lite.zip](https://github.com/johnpapa/lite-server/files/403409/ng2-lite.zip)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.