[SOLVED] Bundle.js not found on localhost in forked project

Hi,

in the forked aurelia project, app builds succesfully, I have even succesfully deployed the app, however, I am failing to run it on localhost.

“Nof found” error for all bunde.js files and even for assets. In the network tab, all paths are for some reason relative (e.g. /user/scripts/*). Accesing directly, http://localhost:9000/scripts/app-bundle.js, works fine.

index.html

<link rel="preload" href="data/configs/app.json?v=0.19.3" as="fetch" type="*/*" crossorigin="anonymous">

<link rel="preload" href="scripts/vendor-bundle.js" as="script">
<link rel="preload" href="scripts/app-bundle.js" as="script">
<link rel="preload" href="scripts/api-bundle.js" as="script">
<link rel="preload" href="scripts/i18n-bundle.js" as="script">
<link rel="preload" href="scripts/ui-bundle.js" as="script">
<link rel="preload" href="scripts/material-bundle.js" as="script">

<link rel="preload" href="scripts/forms-bundle.js" as="script">
<link rel="preload" href="scripts/canvas-bundle.js" as="script">
<link rel="preload" href="scripts/vis-bundle.js" as="script">

aurelia.json

"build": {
"targets": [
  {
    "id": "web",
    "displayName": "Web",
    "port": 9000,
    "index": "index.html",
    "baseDir": ".",
    "output": "scripts"
  }
],

I have been looking into similar issues, but mainly, I dont understand how just forking the app, could lead to this.

I have reinstalled packages (npm ci), changed manualy paths in index.html to “/scripts/…”, which works fine for all except one - app-bundle.js.

I really appreciate any leads on the topic.

1 Like

It sounds like you may need a <base> tag. You can use this to specify the base url that all relative urls are relative to.

MDN Docs

<base href='http://localhost:9000/'>

Or just:

<base href='/'>

Should do the trick.

2 Likes

Thanks granth for the tip, hope it will help others.

However, in my case, I have found out that the source of the issue was related to my identity file and how I am using it to login on localhost.

The error (two accounts and authTokens) was uncatched during compilation. Once I have tried to run the app, handling of account in app-bundle.js errored out, which cascaded into 404 for all my bundled js and assets. Then, I wrongly assumed the source of the problem was in paths.

1 Like