Why the error occurs
This error occurs because for your browser searches for the .css and .js files at "http://localhost:9002/contacts/" instead of "http://localhost:9002/" where your SPA serves these files from.
When using an SPA, you should explicitly set the base url of your page (typically) to the SPA root by adding <base href="/">
within your <head>
element, otherwise your browser simply searches for resources relative to the current url.
What to do
If you are using the latest aurelia-cli
(v2.0.2 at the time of this answer) with Webpack, your index.ejs
file should have the following line;
<base href="<%- htmlWebpackPlugin.options.metadata.baseUrl %>">
which pulls its value from a constant in your webpack.config.js
file.
In webpack.config.js
update the line
const baseUrl = '';
to
const baseUrl = '/';
Your resources should load properly afterwards.
Further reading
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…