Compile Typescript-aurelia-plugin with gulp

Currently I’m trying to compile a typescript aurelia-plugin using gulp but facing the issue, that gulp can’t find the external modules stored in “node_modules”:

My Index.ts:

import { FrameworkConfiguration } from 'aurelia-framework';
import { RouteService } from './Services/ApiService';
import { ApiConfigurationInterface } from './Interfaces/ApiConfigurationInterface';

export function configure(aurelia: FrameworkConfiguration, configCallback?: (config: RouteService) => Promise<any>) {
    //Some Code
}


And my gulp File:

var gulp = require("gulp");
var ts = require('gulp-typescript');

gulp.task("typescript2amd", function(){
  return gulp.src('src/**/*.ts')
  .pipe(ts({
    noImplicitAny: true,
    outFile: 'amd.js',
    module: 'amd'
  }))
  .pipe(gulp.dest('dist/amd'));
});


gulp.task("build", [
  "typescript2amd",
]);

Executing the gulp file I get the following error message:

src/index.ts(1,40): error TS2307: Cannot find module 'aurelia-framework'.

What I’m doing wrong here?

Dunno, maybe you can copy some parts from this one to make it work :slight_smile:

https://github.com/vegarringdal/skeleton-plugin-typescript

1 Like

You are only piping the src folder to the TS compiler. Take a look at the Aurelia cli Tasks for how to compile via the tsconfig.json file or at the source mentioned by @vegarringdal

1 Like

Thank you. Your skeleton works well for me. The only point I don’t understand is, why you have a “sample” folder with “fuse-box”?

@SNO

Thank you. Your skeleton works well for me.

Great

The only point I don’t understand is, why you have a “sample” folder with “fuse-box”?

Developing a plugin without a sample to run it in/that doesnt update plugin on save is hard.
Used fusebox because I hated webpack and had no clue how to set it up like I needed it and jspm was slow as ##%43 :slight_smile:

Btw only reason why it have gulp is that I had not added emit code to the typechecker Ive made and I didnt know much about fusebox sparky when I made it

show how to do that here: