0

I'm using the latest angular / quickstart project which uses systemjs-angular-loader.js for loading app relative html templates (without needing the moduleId property).

The project is working fine in development/test (using the "npm start" to serve pages). However, when building for production using gulp the project reverts to looking for html templates in the root folder (not the app relative folder).

Are there any special steps required for using/building "systemjs-angular-loader.js" in production? The only references I can find to system-angular-loader.js are 404s after updating to systemjs-angular-loader.js which I have followed but that didn't help.

I've not included my gulpfile.js for brevity but I'm using gulp-typescript and systemjs-builder (amongst others).

Community
  • 1
  • 1
Chet
  • 199
  • 10

1 Answers1

0

This might not be the solution to your case, but for other people having the same issue when running karma, you need to update to the latest systemjs-angular-loader.js.

There was a recent change to fix external templates not being loaded: link and issue

For this fix to work make sure the template file is in the same folder as the component referencing it, and that you have a template url in the form of

templateUrl: './myComponent.component.html'

This is because the systemjs-angular-loader checks for a dot in the templateUrl

  if (url.startsWith('.')) {
    resolvedUrl = basePath + url.substr(1);
  }
Almenon
  • 1,191
  • 11
  • 22