fix(webpack): use async type-checking in watch mode

This commit is contained in:
rigor789
2021-08-03 15:41:49 +02:00
parent 5a3a35d376
commit 5309f2d0a7
10 changed files with 62 additions and 22 deletions

View File

@ -123,7 +123,12 @@ exports[`angular configuration for android 1`] = `
},
/* config.module.rule('css') */
{
test: /app(\\\\.\\\\w+)?\\\\.css$/,
test: /\\\\.css$/,
include: [
'__jest__/src/app.css',
'__jest__/src/app.android.css',
/node_modules/
],
use: [
/* config.module.rule('css').use('apply-css-loader') */
{
@ -148,7 +153,12 @@ exports[`angular configuration for android 1`] = `
},
/* config.module.rule('scss') */
{
test: /app(\\\\.\\\\w+)?\\\\.scss$/,
test: /\\\\.scss$/,
include: [
'__jest__/src/app.scss',
'__jest__/src/app.android.scss',
/node_modules/
],
use: [
/* config.module.rule('scss').use('apply-css-loader') */
{
@ -206,7 +216,9 @@ exports[`angular configuration for android 1`] = `
{
test: /\\\\.css$/,
exclude: [
/app(\\\\.\\\\w+)?\\\\.css$/
'__jest__/src/app.css',
'__jest__/src/app.android.css',
/node_modules/
],
use: [
/* config.module.rule('css|component').use('raw-loader') */
@ -219,7 +231,9 @@ exports[`angular configuration for android 1`] = `
{
test: /\\\\.scss$/,
exclude: [
/app(\\\\.\\\\w+)?\\\\.scss$/
'__jest__/src/app.css',
'__jest__/src/app.android.css',
/node_modules/
],
use: [
/* config.module.rule('scss|component').use('raw-loader') */
@ -494,7 +508,12 @@ exports[`angular configuration for ios 1`] = `
},
/* config.module.rule('css') */
{
test: /app(\\\\.\\\\w+)?\\\\.css$/,
test: /\\\\.css$/,
include: [
'__jest__/src/app.css',
'__jest__/src/app.ios.css',
/node_modules/
],
use: [
/* config.module.rule('css').use('apply-css-loader') */
{
@ -519,7 +538,12 @@ exports[`angular configuration for ios 1`] = `
},
/* config.module.rule('scss') */
{
test: /app(\\\\.\\\\w+)?\\\\.scss$/,
test: /\\\\.scss$/,
include: [
'__jest__/src/app.scss',
'__jest__/src/app.ios.scss',
/node_modules/
],
use: [
/* config.module.rule('scss').use('apply-css-loader') */
{
@ -577,7 +601,9 @@ exports[`angular configuration for ios 1`] = `
{
test: /\\\\.css$/,
exclude: [
/app(\\\\.\\\\w+)?\\\\.css$/
'__jest__/src/app.css',
'__jest__/src/app.ios.css',
/node_modules/
],
use: [
/* config.module.rule('css|component').use('raw-loader') */
@ -590,7 +616,9 @@ exports[`angular configuration for ios 1`] = `
{
test: /\\\\.scss$/,
exclude: [
/app(\\\\.\\\\w+)?\\\\.scss$/
'__jest__/src/app.css',
'__jest__/src/app.ios.css',
/node_modules/
],
use: [
/* config.module.rule('scss|component').use('raw-loader') */

View File

@ -223,6 +223,7 @@ exports[`base configuration for android 1`] = `
/* config.plugin('ForkTsCheckerWebpackPlugin') */
new ForkTsCheckerWebpackPlugin(
{
async: false,
typescript: {
memoryLimit: 4096
}
@ -530,6 +531,7 @@ exports[`base configuration for ios 1`] = `
/* config.plugin('ForkTsCheckerWebpackPlugin') */
new ForkTsCheckerWebpackPlugin(
{
async: false,
typescript: {
memoryLimit: 4096
}

View File

@ -240,6 +240,7 @@ exports[`javascript configuration for android 1`] = `
/* config.plugin('ForkTsCheckerWebpackPlugin') */
new ForkTsCheckerWebpackPlugin(
{
async: false,
typescript: {
memoryLimit: 4096
}
@ -320,10 +321,10 @@ exports[`javascript configuration for android 1`] = `
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'__jest__/src/__@nativescript_webpack_virtual_entry_javascript__',
'__jest__/src/app.js',
'@nativescript/core/ui/frame',
'@nativescript/core/ui/frame/activity',
'__jest__/src/__@nativescript_webpack_virtual_entry_javascript__'
'@nativescript/core/ui/frame/activity'
]
}
}"
@ -569,6 +570,7 @@ exports[`javascript configuration for ios 1`] = `
/* config.plugin('ForkTsCheckerWebpackPlugin') */
new ForkTsCheckerWebpackPlugin(
{
async: false,
typescript: {
memoryLimit: 4096
}
@ -649,8 +651,8 @@ exports[`javascript configuration for ios 1`] = `
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'__jest__/src/app.js',
'__jest__/src/__@nativescript_webpack_virtual_entry_javascript__'
'__jest__/src/__@nativescript_webpack_virtual_entry_javascript__',
'__jest__/src/app.js'
],
'tns_modules/inspector_modules': [
'@nativescript/core/inspector_modules'

View File

@ -238,6 +238,7 @@ exports[`react configuration > android > adds ReactRefreshWebpackPlugin when HMR
/* config.plugin('ForkTsCheckerWebpackPlugin') */
new ForkTsCheckerWebpackPlugin(
{
async: false,
typescript: {
memoryLimit: 4096
}
@ -556,6 +557,7 @@ exports[`react configuration > android > base config 1`] = `
/* config.plugin('ForkTsCheckerWebpackPlugin') */
new ForkTsCheckerWebpackPlugin(
{
async: false,
typescript: {
memoryLimit: 4096
}
@ -874,6 +876,7 @@ exports[`react configuration > ios > adds ReactRefreshWebpackPlugin when HMR ena
/* config.plugin('ForkTsCheckerWebpackPlugin') */
new ForkTsCheckerWebpackPlugin(
{
async: false,
typescript: {
memoryLimit: 4096
}
@ -1193,6 +1196,7 @@ exports[`react configuration > ios > base config 1`] = `
/* config.plugin('ForkTsCheckerWebpackPlugin') */
new ForkTsCheckerWebpackPlugin(
{
async: false,
typescript: {
memoryLimit: 4096
}

View File

@ -248,6 +248,7 @@ exports[`svelte configuration for android 1`] = `
/* config.plugin('ForkTsCheckerWebpackPlugin') */
new ForkTsCheckerWebpackPlugin(
{
async: false,
typescript: {
memoryLimit: 4096
}
@ -574,6 +575,7 @@ exports[`svelte configuration for ios 1`] = `
/* config.plugin('ForkTsCheckerWebpackPlugin') */
new ForkTsCheckerWebpackPlugin(
{
async: false,
typescript: {
memoryLimit: 4096
}

View File

@ -240,6 +240,7 @@ exports[`typescript configuration for android 1`] = `
/* config.plugin('ForkTsCheckerWebpackPlugin') */
new ForkTsCheckerWebpackPlugin(
{
async: false,
typescript: {
memoryLimit: 4096
}
@ -320,10 +321,10 @@ exports[`typescript configuration for android 1`] = `
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'__jest__/src/__@nativescript_webpack_virtual_entry_typescript__',
'__jest__/src/app.js',
'@nativescript/core/ui/frame',
'@nativescript/core/ui/frame/activity',
'__jest__/src/__@nativescript_webpack_virtual_entry_typescript__'
'@nativescript/core/ui/frame/activity'
]
}
}"
@ -569,6 +570,7 @@ exports[`typescript configuration for ios 1`] = `
/* config.plugin('ForkTsCheckerWebpackPlugin') */
new ForkTsCheckerWebpackPlugin(
{
async: false,
typescript: {
memoryLimit: 4096
}
@ -649,8 +651,8 @@ exports[`typescript configuration for ios 1`] = `
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'__jest__/src/app.js',
'__jest__/src/__@nativescript_webpack_virtual_entry_typescript__'
'__jest__/src/__@nativescript_webpack_virtual_entry_typescript__',
'__jest__/src/app.js'
],
'tns_modules/inspector_modules': [
'@nativescript/core/inspector_modules'

View File

@ -257,6 +257,7 @@ exports[`vue configuration for android 1`] = `
/* config.plugin('ForkTsCheckerWebpackPlugin') */
new ForkTsCheckerWebpackPlugin(
{
async: false,
typescript: {
memoryLimit: 4096,
extensions: {
@ -598,6 +599,7 @@ exports[`vue configuration for ios 1`] = `
/* config.plugin('ForkTsCheckerWebpackPlugin') */
new ForkTsCheckerWebpackPlugin(
{
async: false,
typescript: {
memoryLimit: 4096,
extensions: {

View File

@ -56,6 +56,8 @@ program
env['env'] = options.env;
}
env['watch'] = options.watch;
const configPath = (() => {
if (options.config) {
return path.resolve(options.config);

View File

@ -186,7 +186,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
paths.indexOf('@nativescript/core/globals/index.js')
] = polyfillsPath;
// replace paths with the update paths
// replace paths with the updated paths
config.entry('bundle').clear().merge(paths);
}
}

View File

@ -233,11 +233,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
.plugin('ForkTsCheckerWebpackPlugin')
.use(ForkTsCheckerWebpackPlugin, [
{
// If we use "async" errors compiling typescript will be ignored by
// WebPack (we will send the "compilation" message back to the CLI,
// and the process exit code will be zero), therefore we will end
// up with a broken build
async: false,
async: !!env.watch,
typescript: {
memoryLimit: 4096,
},