2.0.4 • Published 4 years ago

@reactway/webpack-builder-plugin-typescript v2.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

@reactway/webpack-builder-plugin-typescript

A plugin made for webpack-builder.

Getting started

$ npm i @reactway/webpack-builder-plugin-typescript

Add plugin into webpack config by using use() builder method.

const webpackBuilder = require("@reactway/webpack-builder");
const typeScript = require("@reactway/webpack-builder-plugin-typescript");

module.exports = new webpackBuilder.Builder(__dirname, {
    entry: "./src/app.js",
    output: {
        path: "./dist",
        filename: "[name].bundle.js"
    }
})
    .use(typeScript.TypeScriptPlugin)
    .toConfig();

Works well with react typescript version. If you are planning to use json be sure add

"linterOptions": {
    "exclude": [
      "*.json",
      "**/*.json"
    ]
  }

at tslint.json file.

Passing options

It have wrapped fork-ts-checker-webpack-plugin and tsconfig-paths-webpack-plugin. You can pass both plugin options separate.

const webpackBuilder = require("@reactway/webpack-builder");
const typeScript = require("@reactway/webpack-builder-plugin-typescript");

module.exports = new webpackBuilder.Builder(__dirname, {
    entry: "./src/app.js",
    output: {
        path: "./dist",
        filename: "[name].bundle.js"
    }
})
    .use(typeScript.TypeScriptPlugin, {
        forkTsCheckerOptions: {
            formatter: "codeframe",
            silent: true,
            ...
        },
        ...
    })
    .toConfig();

Documentation

WIP

License

Released under the MIT license.