We have a gulp script that looks like the following (only the relevant pieces shown):
const gulp = require('gulp');
const typescript = require('gulp-typescript');
const sourcemaps = require('gulp-sourcemaps');
const tscConfig = require('./tsconfig.json');
const inlineNg2Templates = require('gulp-inline-ng2-template');
const paths = {
distAssetsFolder: 'dist/assets',
distFolder: 'dist',
distLibFolder: 'dist/lib',
distFiles: 'dist/**/*',
srcMapFolder: './maps',
srcFiles: 'src/**/*',
srcAssetFolder: 'src/assets/**/*',
srcMainSassFile: 'src/**/main.scss',
srcTsFiles: 'src/**/*.ts',
srcTestFiles : 'src/**/*.spec.ts'
};
gulp.task('transpile-typescript', ['clean:dist'], function () {
return gulp
.src(paths.srcTsFiles)
.pipe(inlineNg2Templates({ useRelativePaths: true}))
.pipe(sourcemaps.init())
.pipe(typescript(tscConfig.compilerOptions))
.pipe(sourcemaps.write(paths.srcMapFolder))
.pipe(gulp.dest(paths.distFolder));
});
We're using JSPM for our dependency management & have jspm-config.js at the root of our project.
Regardless of what task in our gulp script we run we get the following errors:
src\app\sidebar\panel.component.ts(1,46): error TS2307: Cannot find module 'angular2/core'. src\app\sidebar\panel.component.ts(2,30): error TS2307: Cannot find module 'angular2/http'. src\app\uiComponents\demo\demo.ts(1,25): error TS2307: Cannot find module 'angular2/core'. src\app\uiComponents\modal\modal.ts(1,54): error TS2307: Cannot find module 'angular2/core'. src\app\uiComponents\modal\modal.ts(2,23): error TS2307: Cannot find module 'angular2/common'.
However; the app works just fine. At runtime these errors are resolved by the map in our jspm-config.js file which contains something like the following:
"angular2": "npm:[email protected]",
I realize we just need to somehow reference the jspm config at transpile time but I'm just not sure how to do that at this point.
Does anyone have any ideas?