Commit f5385b47 authored by Fabian Keller's avatar Fabian Keller
Browse files

attempt to fix custom loader race condition

1 merge request!10874Attempt to fix custom loader race condition
Showing with 9 additions and 3 deletions
+9 -3
......@@ -141,9 +141,13 @@ function createCompiler({
if (useTypeScript) {
compiler.hooks.beforeCompile.tap('beforeCompile', () => {
tsMessagesPromise = new Promise(resolve => {
tsMessagesResolver = msgs => resolve(msgs);
});
// Make sure promise is only created once. Multiple 'beforeCompile' calls are possible
// with custom loaders.
if (tsMessagesPromise == null) {
tsMessagesPromise = new Promise(resolve => {
tsMessagesResolver = msgs => resolve(msgs);
});
}
});
forkTsCheckerWebpackPlugin
......@@ -190,6 +194,8 @@ function createCompiler({
}, 100);
const messages = await tsMessagesPromise;
tsMessagesPromise = null; // release promise to allow for subsequent 'beforeCompile' calls
clearTimeout(delayedMsg);
if (tscCompileOnError) {
statsData.warnings.push(...messages.errors);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment