gulp-typescript-path-resolver
TypeScript icon, indicating that this package has built-in type declarations

0.0.1-c • Public • Published

gulp-typescript-path-resolver

This is a simple module to replace the typescript path with original path

example

const gulp = require('gulp');
const ts = require('gulp-typescript');
const ts_import = require('gulp-typescript-path-resolver');
 
const tsProject = ts.createProject('./tsconfig.json');
 
gulp.task('build', () => {
    return tsProject.src()
        .pipe(tsProject())
        .pipe(ts_import.tsPathResolver(tsProjectSource.config.compilerOptions, {
            // You can Overwrite the path
            "paths": {
                "@app/env": [
                    "environments/environment"
                ]
            }
        }))
        .pipe(gulp.dest(tsProject.config.compilerOptions.outDir))
});
 

your tsconfig.json

 
{
  "compilerOptions": {
  "outDir": "./dest"
  , "rootDir": "./src"
  , "noImplicitAny": false
  , "baseUrl": "./src"
  , "module": "commonjs"
  , "paths": {
      "@app/env": [
        "environments/environment"
      ]
      , "@modules/*": [
        "modules/*"
      ]
      , "@util/*": [
        "modules/util/*"
      ]
    }
  }
}
 

Note: Don't forget to add rootDir option

Package Sidebar

Install

npm i gulp-typescript-path-resolver

Weekly Downloads

62

Version

0.0.1-c

License

MIT

Unpacked Size

4.99 kB

Total Files

8

Last publish

Collaborators

  • atik