[SOLVED] Aurelia & Webpack: "Unable to find module with id"

I’ve seen a number of issues posted here with a similar topic. Most of the suggestions talk about the need for PLATFORM.moduleName() – which I’ve tried with no success.

I have a View Model that displays a number of different dialogs (approx 6 different dialogs). All of the dialogs work during dev. However, once I build and release to production – one dialog no longer works but gives the following error:

Error: Unable to find module with ID: 9yG/.html

sessions.ts - original code

import {Dialog1} from './dialog1'
import {Dialog2} from './dialog2'

export class SessionJurors {
   ...

   displayDialog1(){  //<== Non working dialog
      this.dialogService.open({viewModel: Dialog1, model: this.sessionPK})
       ...
   }

   displayDialog2(){  //<== Working dialog
      this.dialogService.open({viewModel: Dialog2, model: this.sessionPK})
     ...
   }
}

Based on other posts, I tried adding the following to the top of sessions.ts.

UPDATE: Ultimately, this is what solved my issue. However, be sure to refresh your client cache so that you actually see the changes reflected in production

PLATFORM.moduleName("./dialog1")

That didn’t help so I tried something else I saw posted. I added the following to dialog1.ts

dialog1.ts

@useView('./dialog1.html')  //<-- Added this
export class Dialog1{
   ...
}

I now get the first error along with an additional error:

Failed to load resource: the server responded with a status of 404 (Not Found)

Where am I going wrong with this? Thanks for any help!

Does this one perhaps help? Seems to be a similar issue (Solved) Error: Cannot determine default view strategy for object

Thanks. As you can see from my original post, I had already tried that (i.e. adding PLATFORM.moduleName('./dialog1')

However, I realized I was running into a caching issue. I made the change and copied it to the server. But, production builds with webpack (at least in my case) re-use the same chunk names. Those items were already cached so I wasn’t actually hitting my new instance of the code.

1 Like