I'm currently learning how to work with Typescript 2, Webpack and Angular 1.5, but I keep encountering an issue during the build process where Webpack gives me this error message:
Cannot resolve module '@types/angular' in C:\play\gt\src
I've searched online and tried different things, but so far I haven't been able to solve it.
This is what my app.ts file looks like:
import * as angular from "@types/angular";
let app = angular.module ("GT.module", []);
Here's a snippet of my tsconfig file:
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"typeRoots" : [
"node_modules/@types"
]
},
"exclude": [
"node_modules",
"**/*.spec.ts"
],
"include" : [
"src/**/*"
]
}
Lastly, here's my webpack configuration:
module.exports = {
entry: './src/app.ts',
output: {
filename: './dist/app.js'
},
devtool: "source-map",
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.ts', '.js'],
modulesDirectories: ["node_modules"]
},
module: {
loaders: [
{ test: /\.ts$/, loader: 'ts-loader' }
]
}
}