mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat: add ForkTsChecker
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user