feat: add ForkTsChecker

This commit is contained in:
Igor Randjelovic
2020-11-25 12:41:45 +01:00
parent 1894cd46e8
commit 015d337e2a
7 changed files with 116 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ import { DefinePlugin, HotModuleReplacementPlugin } from 'webpack';
import Config from 'webpack-chain';
import path from 'path';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
@@ -134,6 +135,15 @@ export default function (config: Config, env: IWebpackEnv): Config {
},
});
// Use Fork TS Checker to do type checking in a separate non-blocking process
config.plugin('ForkTsCheckerWebpackPlugin').use(ForkTsCheckerWebpackPlugin, [
{
typescript: {
memoryLimit: 4096,
},
},
]);
// set up js
// todo: do we need babel-loader? It's useful to support it
config.module

View File

@@ -39,6 +39,20 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
});
});
config.plugin('ForkTsCheckerWebpackPlugin').tap((args) => {
args[0] = merge(args[0], {
typescript: {
extensions: {
vue: {
enabled: true,
compiler: 'nativescript-vue-template-compiler',
},
},
},
});
return args;
});
// add VueLoaderPlugin as the first plugin
config
.plugin('VueLoaderPlugin')