TypeScript loader All In One
TypeScript loader All In One
$ yarn add -D @types/react @types/react-dom
$ npm i -D typescript ts-loader
ts-loader
$ yarn add -D ts-loader
https://github.com/TypeStrong/ts-loader
https://webpack.js.org/guides/typescript/
fork-ts-checker-webpack-plugin
$ yarn add -D fork-ts-checker-webpack-plugin
https://github.com/TypeStrong/fork-ts-checker-webpack-plugin
// webpack.config.js
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
module.exports = {
context: __dirname, // to automatically find tsconfig.json
entry: './src/index.ts',
resolve: {
extensions: [".ts", ".tsx", ".js"],
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
// disable type checker - we will use it in fork plugin
transpileOnly: true
}
}
]
},
plugins: [new ForkTsCheckerWebpackPlugin()]
};
awesome-typescript-loader
$ npm i -D awesome-typescript-loader
https://github.com/s-panferov/awesome-typescript-loader
refs
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/14617837.html
未经授权禁止转载,违者必究!