I need to set up AoT compilation for my Angular 2 project.
My application is organized into a js
directory where all generated .js
files are stored, and an app
directory containing my .ts
, .html
, and .css
files.
For the AoT compilation process, I am using the tsconfig.aot.json
file:
{
"compilerOptions": {
// compiler options here
},
"files": [
"app/main.ts"
],
"exclude": [
"node_modules",
"js",
"app"
],
"compileOnSave": false
}
And the script looks like this:
"ngc": "ngc -p tsconfig.aot.json && npm run copy \"app/*\" \"compiled\" "
Here's how my components are structured:
@Component({
selector: 'fs-mainbar',
templateUrl: 'app/mainbar/mainbar.component.html'
})
export class MainbarComponent {
However, when running the script, I encounter the following error:
Error: Compilation failed. Resource file not found...
// Error details go on
It seems like I should be using module.id
, but due to the separation of my app directories, I have to adjust it in this way:
@Component({
moduleId: module.id.replace("/js/", "/app/"),
selector: 'escl-mainbar',
templateUrl: './mainbar.component.html'
})
export class MainbarComponent {
But this modification leads to another error:
Error encountered resolving symbol values statically. Calling function 'module', function calls are not supported...
// Further error details provided
At this point, I'm stuck. Any assistance or suggestions on how to resolve this issue would be greatly appreciated :)
Issue link on Github: