-
-
Save awwsmm/4262b75757573b1965ce8dad640b098f to your computer and use it in GitHub Desktop.
A simple Webpack configuration to compile TypeScript projects with fork-ts-checker-webpack-plugin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require( 'path' ); | |
const ForkTsCheckerWebpackPlugin = require( 'fork-ts-checker-webpack-plugin' ); | |
module.exports = { | |
// generate source maps | |
devtool: 'source-map', | |
// bundling mode | |
mode: 'production', | |
// entry files | |
entry: './sandbox/index.ts', | |
// output bundles (location) | |
output: { | |
path: path.resolve( __dirname, 'build' ), | |
filename: 'index.js', | |
}, | |
// file resolutions | |
resolve: { | |
extensions: [ '.ts', '.js' ], | |
alias: { | |
src: path.resolve(__dirname, 'src/') | |
}, | |
}, | |
// loaders | |
module: { | |
rules: [ | |
{ | |
test: /\.tsx?/, | |
use: { | |
loader: 'ts-loader', | |
options: { | |
transpileOnly: true, | |
} | |
}, | |
exclude: /node_modules/, | |
} | |
] | |
}, | |
// plugins | |
plugins: [ | |
new ForkTsCheckerWebpackPlugin(), // run TSC on a separate thread | |
], | |
// set watch mode to `true` | |
watch: true | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment