私は活字体2、WebPACKのと角1.5を使用してグリップを取得しようとしますが、WebPACKのを構築することという文句は続けるとしています@/node_modulesを使用するようにWebPACKのを説得:種類
は角タイプ/ @モジュール」を解決できません。 'in C:\ play \ gt \ src
私は困惑しています。これをグーグルで見ていて、だんだんと混乱していますが、どこにもいません。
import * as angular from "@types/angular";
let app = angular.module ("GT.module", []);
私のTSconfigは、次のようになります:
私app.tsは次のようになります
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"typeRoots" : [
"node_modules/@types"
]
},
"exclude": [
"node_modules",
"**/*.spec.ts"
],
"include" : [
"src/**/*"
]
}
...そして最後のWebPACKの設定:
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' }
]
}
}
が
ありがとうございます!それはそれを解決しました。 Typescriptのゴールポストは動いているようで、最新の記事を見つけるのは非常に難しいです。 – jeffeld
ええ、私は知っている、JavaScriptのエコシステムはかなり速く進化し、公式のドキュメントを試して、それはかなりよく維持されます。たとえば、このリンクはwebpackをtypescriptで囲みます:https://www.typescriptlang.org/docs/handbook/react-&-webpack.html –