我已阅读并遵循此处和此处给出的说明和建议,但仍然无法阻止此错误弹出。以下是我遵循的安装说明
以下是我的 tsconfig 文件
{
"compileOnSave": true,
"compilerOptions": {
"typeRoots": [ "libs/@types" ],
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"noEmitOnError": true,
"noImplicitAny": false,
"outDir": "../wwwroot/appScripts/",
"removeComments": false,
"sourceMap": true,
"target": "es6",
"moduleResolution": "node"
},
"exclude": [
"node_modules",
"typings/index",
"typings/index.d.ts",
"typings/browser",
"typings/browser.d.ts"
]
}
我的 gulpfile
var ts = require('gulp-typescript');
var gulp = require('gulp');
var clean = require('gulp-clean');
var destPath = './wwwroot/libs/';
gulp.task('clean', function () {
return gulp.src(destPath)
.pipe(clean());
});
gulp.task("scriptsNStyles", () => {
gulp.src([
'core-js/client/**',
'systemjs/dist/system.src.js',
'reflect-metadata/**',
'rxjs/**',
'zone.js/dist/**',
'jquery/dist/jquery.*js',
'bootstrap/dist/js/bootstrap.*js',
'ng2-bootstrap/**',
'lodash/**',
'moment/**',
'symbol-observable/**',
'hammerjs/**',
'jasmine/**',
'@types/**',
'@angular/**'
], {
cwd: "node_modules/**"
})
.pipe(gulp.dest("./wwwroot/libs"));
});
var tsProject = ts.createProject('scripts/tsconfig.json'
,{ typescript: require('typescript') }
);
gulp.task('ts', function (done) {
//var tsResult = tsProject.src();
var tsResult = gulp.src(["scripts/**/*.ts","scripts/**/**/*.ts", "scripts/*.ts"])
.pipe(ts(tsProject), undefined, ts.reporter.fullReporter());
return tsResult.js.pipe(gulp.dest('./wwwroot/appScripts'));
});
gulp.task('watch', ['watch.ts']);
gulp.task('watch.ts', ['ts'], function () {
return gulp.watch('scripts/**/*.ts', ['ts']);
});
gulp.task('default', ['scriptsNStyles', 'watch']);
我的 main.ts 文件
/// <reference path="../wwwroot/libs/@types/hammerjs/index.d.ts" />
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
import { AppModule } from "./app.module";
platformBrowserDynamic().bootstrapModule(AppModule);
我已经失去了一半的头发试图弄清楚这一点。我确信我一定在某些地方犯了一些愚蠢的错误。