Skip to content

piecyk/tsc-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tsc-webpack-plugin

A TypeScript plugin that runs tsc command and push output to webpack.

Install

This plugin requires minimum node 10, webpack 4.37.0

yarn add -D tsc-webpack-plugin

Example how to configure it with babel-loader can be found in example directory.

Using babel for transpiling, webpack for bundling and tsc for types.

Usage

In your webpack configuration:

const TscWebpackPlugin = require("tsc-webpack-plugin");

module.exports = {
  mode: "development",
  entry: "./src/index.ts",
  resolve: {
    extensions: [".ts", ".tsx", ".js"],
  },
  module: {
    rules: [
      {
        test: /\.(ts|js)x?$/,
        exclude: /node_modules/,
        loader: "babel-loader",
      },
    ],
  },
  plugins: [new TscWebpackPlugin()],
};

Options

You can pass tsc CLI Options as object to plugin.

For example cli --build --project ./config/tsconfig.json will be

const TscWebpackPlugin = require("tsc-webpack-plugin");

module.exports = {
  // ...
  plugins: [
    new TscWebpackPlugin({ build: "", project: "./config/tsconfig.json" }),
  ],
  // ...
};

License

MIT License

About

A TypeScript plugin for webpack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published