I am following the Component Relative Paths for templates and styles guide available at:
https://angular.io/docs/ts/latest/cookbook/component-relative-paths.html
The guide suggests that if we build our application as commonjs modules and load those modules with a suitable package loader such as systemjs we can specify template and style locations relative to their component class file.
All we need to do is put component template and component-specific style files as siblings of their companion component class files. Having adopted this file structure convention, we can specify locations of the template and style files relative to the component class file simply by setting the moduleId property of the @Component metadata like this
@Component({
moduleId: module.id,
selector: 'relative-path',
templateUrl: 'some.component.html',
styleUrls: ['some.component.css']
})
I am using Visual Studio 2015 TypeScript 2.0 Beta and below is my tsconfig file:
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": false,
"target": "es5",
"outDir": "../content/app/"
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
But when I try to compile my project it doesn't recognize module.id in @Component metadata and throws the error:
Severity Code Description Project File Line Suppression State
Error Build:Cannot find name 'module'.
Can anyone please guide how to fix this?