mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
feat: add ForkTsChecker
This commit is contained in:
@ -158,6 +158,14 @@ exports[`react configuration > android > adds ReactRefreshWebpackPlugin when HMR
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
/* config.plugin('ForkTsCheckerWebpackPlugin') */
|
||||||
|
new ForkTsCheckerWebpackPlugin(
|
||||||
|
{
|
||||||
|
typescript: {
|
||||||
|
memoryLimit: 4096
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
/* config.plugin('CleanWebpackPlugin') */
|
/* config.plugin('CleanWebpackPlugin') */
|
||||||
new CleanWebpackPlugin(
|
new CleanWebpackPlugin(
|
||||||
{
|
{
|
||||||
@ -383,6 +391,14 @@ exports[`react configuration > android > base config 1`] = `
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
/* config.plugin('ForkTsCheckerWebpackPlugin') */
|
||||||
|
new ForkTsCheckerWebpackPlugin(
|
||||||
|
{
|
||||||
|
typescript: {
|
||||||
|
memoryLimit: 4096
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
/* config.plugin('CleanWebpackPlugin') */
|
/* config.plugin('CleanWebpackPlugin') */
|
||||||
new CleanWebpackPlugin(
|
new CleanWebpackPlugin(
|
||||||
{
|
{
|
||||||
@ -608,6 +624,14 @@ exports[`react configuration > ios > adds ReactRefreshWebpackPlugin when HMR ena
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
/* config.plugin('ForkTsCheckerWebpackPlugin') */
|
||||||
|
new ForkTsCheckerWebpackPlugin(
|
||||||
|
{
|
||||||
|
typescript: {
|
||||||
|
memoryLimit: 4096
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
/* config.plugin('CleanWebpackPlugin') */
|
/* config.plugin('CleanWebpackPlugin') */
|
||||||
new CleanWebpackPlugin(
|
new CleanWebpackPlugin(
|
||||||
{
|
{
|
||||||
@ -836,6 +860,14 @@ exports[`react configuration > ios > base config 1`] = `
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
/* config.plugin('ForkTsCheckerWebpackPlugin') */
|
||||||
|
new ForkTsCheckerWebpackPlugin(
|
||||||
|
{
|
||||||
|
typescript: {
|
||||||
|
memoryLimit: 4096
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
/* config.plugin('CleanWebpackPlugin') */
|
/* config.plugin('CleanWebpackPlugin') */
|
||||||
new CleanWebpackPlugin(
|
new CleanWebpackPlugin(
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,8 @@ exports[`svelte configuration for android 1`] = `
|
|||||||
hotOptions: {
|
hotOptions: {
|
||||||
injectCss: false,
|
injectCss: false,
|
||||||
'native': true
|
'native': true
|
||||||
}
|
},
|
||||||
|
onwarn: function () { /* omitted long function */ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -172,6 +173,14 @@ exports[`svelte configuration for android 1`] = `
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
/* config.plugin('ForkTsCheckerWebpackPlugin') */
|
||||||
|
new ForkTsCheckerWebpackPlugin(
|
||||||
|
{
|
||||||
|
typescript: {
|
||||||
|
memoryLimit: 4096
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
/* config.plugin('CleanWebpackPlugin') */
|
/* config.plugin('CleanWebpackPlugin') */
|
||||||
new CleanWebpackPlugin(
|
new CleanWebpackPlugin(
|
||||||
{
|
{
|
||||||
@ -375,7 +384,8 @@ exports[`svelte configuration for ios 1`] = `
|
|||||||
hotOptions: {
|
hotOptions: {
|
||||||
injectCss: false,
|
injectCss: false,
|
||||||
'native': true
|
'native': true
|
||||||
}
|
},
|
||||||
|
onwarn: function () { /* omitted long function */ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -409,6 +419,14 @@ exports[`svelte configuration for ios 1`] = `
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
/* config.plugin('ForkTsCheckerWebpackPlugin') */
|
||||||
|
new ForkTsCheckerWebpackPlugin(
|
||||||
|
{
|
||||||
|
typescript: {
|
||||||
|
memoryLimit: 4096
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
/* config.plugin('CleanWebpackPlugin') */
|
/* config.plugin('CleanWebpackPlugin') */
|
||||||
new CleanWebpackPlugin(
|
new CleanWebpackPlugin(
|
||||||
{
|
{
|
||||||
|
@ -169,6 +169,20 @@ exports[`vue configuration for android 1`] = `
|
|||||||
plugins: [
|
plugins: [
|
||||||
/* config.plugin('VueLoaderPlugin') */
|
/* config.plugin('VueLoaderPlugin') */
|
||||||
new VueLoaderPlugin(),
|
new VueLoaderPlugin(),
|
||||||
|
/* config.plugin('ForkTsCheckerWebpackPlugin') */
|
||||||
|
new ForkTsCheckerWebpackPlugin(
|
||||||
|
{
|
||||||
|
typescript: {
|
||||||
|
memoryLimit: 4096,
|
||||||
|
extensions: {
|
||||||
|
vue: {
|
||||||
|
enabled: true,
|
||||||
|
compiler: 'nativescript-vue-template-compiler'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
/* config.plugin('CleanWebpackPlugin') */
|
/* config.plugin('CleanWebpackPlugin') */
|
||||||
new CleanWebpackPlugin(
|
new CleanWebpackPlugin(
|
||||||
{
|
{
|
||||||
@ -403,6 +417,20 @@ exports[`vue configuration for ios 1`] = `
|
|||||||
plugins: [
|
plugins: [
|
||||||
/* config.plugin('VueLoaderPlugin') */
|
/* config.plugin('VueLoaderPlugin') */
|
||||||
new VueLoaderPlugin(),
|
new VueLoaderPlugin(),
|
||||||
|
/* config.plugin('ForkTsCheckerWebpackPlugin') */
|
||||||
|
new ForkTsCheckerWebpackPlugin(
|
||||||
|
{
|
||||||
|
typescript: {
|
||||||
|
memoryLimit: 4096,
|
||||||
|
extensions: {
|
||||||
|
vue: {
|
||||||
|
enabled: true,
|
||||||
|
compiler: 'nativescript-vue-template-compiler'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
/* config.plugin('CleanWebpackPlugin') */
|
/* config.plugin('CleanWebpackPlugin') */
|
||||||
new CleanWebpackPlugin(
|
new CleanWebpackPlugin(
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,17 @@ jest.mock(
|
|||||||
{ virtual: true }
|
{ virtual: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
jest.mock('cosmiconfig', () => ({
|
||||||
|
cosmiconfigSync(moduleName) {
|
||||||
|
return {
|
||||||
|
search() {
|
||||||
|
// no-op in tests
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
jest.mock('path', () => ({
|
jest.mock('path', () => ({
|
||||||
...jest.requireActual('path'),
|
...jest.requireActual('path'),
|
||||||
// we are mocking resolve to just simply join the paths for tests
|
// we are mocking resolve to just simply join the paths for tests
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
"copy-webpack-plugin": "^6.3.2",
|
"copy-webpack-plugin": "^6.3.2",
|
||||||
"css": "^3.0.0",
|
"css": "^3.0.0",
|
||||||
"css-loader": "^5.0.1",
|
"css-loader": "^5.0.1",
|
||||||
|
"fork-ts-checker-webpack-plugin": "^6.0.3",
|
||||||
"loader-utils": "^2.0.0",
|
"loader-utils": "^2.0.0",
|
||||||
"react-refresh": "^0.9.0",
|
"react-refresh": "^0.9.0",
|
||||||
"sass": "^1.29.0",
|
"sass": "^1.29.0",
|
||||||
|
@ -2,6 +2,7 @@ import { DefinePlugin, HotModuleReplacementPlugin } from 'webpack';
|
|||||||
import Config from 'webpack-chain';
|
import Config from 'webpack-chain';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
|
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
||||||
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
||||||
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
|
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
|
||||||
import CopyWebpackPlugin from 'copy-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
|
// set up js
|
||||||
// todo: do we need babel-loader? It's useful to support it
|
// todo: do we need babel-loader? It's useful to support it
|
||||||
config.module
|
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
|
// add VueLoaderPlugin as the first plugin
|
||||||
config
|
config
|
||||||
.plugin('VueLoaderPlugin')
|
.plugin('VueLoaderPlugin')
|
||||||
|
Reference in New Issue
Block a user