Skip to content

zojeda/typescript-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Typescript webpack plugin

A webpack plugin used to compile typescript projects.

Here we use typecript compiler instead of language service, in order to speed up the starting process, so all the files speciefied in file glob are compiled in bulk.

A naive file change detection was implemented in order to compile only changed files (and dependencies) on every run, other compiled files are stored in a cache directory.

Plugin options

{
  tsconfig: { filesGlob: string[], compilerOptions: ts.CompilerOptions },
  transpileOnly?: boolean; //not implemented yet
  cacheDir?: string;
  include?: string[];
  exclude?: string[];
}

Sample configuration

var TSPlugin = require('typescript-webpack-plugin');
config = {
    module: {
    ...
    loaders: [
        {
            test: /\.ts$/,
            loader: ['typescript-webpack-plugin/dist/loader'],
            exclude: /(node_modules|dist)/
        }
    ...
    },
    plugins = [
    ...
      new TSPlugin({tsconfig: require('./tsconfig.json')})
    ...

    )
    ...
}

A lot of code is from ts-loader, here I'm trying to learn from it and make the start up of the application faster.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published