Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 26.9k
Webpack5 update [DRAFT]#10656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Webpack5 update [DRAFT] #10656
Changes from all commits
cdb7ec0878f8c479b16d48d5d16f0254dc96777da0f959414fb56a1448c5456468ffe64d0be4acfee80738d72e75bef91458d36c2a89a63a74ed0c719faf8cbbf93d273c952b33f90645e79ffac0e4c4d871b2e9613e2a5952f8962217ab76eef86c0170343File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -5,6 +5,9 @@ | ||
| /.pnp | ||
| .pnp.js | ||
| # build cache info | ||
| tsconfig.tsbuildinfo | ||
| # testing | ||
| /coverage | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -17,7 +17,6 @@ const prompts = require('prompts'); | ||
| const clearConsole = require('./clearConsole'); | ||
| const formatWebpackMessages = require('./formatWebpackMessages'); | ||
| const getProcessForPort = require('./getProcessForPort'); | ||
| const typescriptFormatter = require('./typescriptFormatter'); | ||
| const forkTsCheckerWebpackPlugin = require('./ForkTsCheckerWebpackPlugin'); | ||
| const isInteractive = process.stdout.isTTY; | ||
| @@ -104,11 +103,9 @@ function printInstructions(appName, urls, useYarn) { | ||
| function createCompiler({ | ||
| appName, | ||
| config, | ||
| devSocket, | ||
| urls, | ||
| useYarn, | ||
| useTypeScript, | ||
| tscCompileOnError, | ||
| webpack, | ||
| }) { | ||
| // "Compiler" is a low-level interface to webpack. | ||
| @@ -137,28 +134,16 @@ function createCompiler({ | ||
| let isFirstCompile = true; | ||
| let tsMessagesPromise; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
| ||
| let tsMessagesResolver; | ||
| if (useTypeScript) { | ||
| compiler.hooks.beforeCompile.tap('beforeCompile', () => { | ||
| tsMessagesPromise = new Promise(resolve => { | ||
| tsMessagesResolver = msgs => resolve(msgs); | ||
| }); | ||
| }); | ||
| forkTsCheckerWebpackPlugin | ||
| .getCompilerHooks(compiler) | ||
| .receive.tap('afterTypeScriptCheck', (diagnostics, lints) => { | ||
| const allMsgs = [...diagnostics, ...lints]; | ||
| const format = message => | ||
| `${message.file}\n${typescriptFormatter(message, true)}`; | ||
| tsMessagesResolver({ | ||
| errors: allMsgs.filter(msg => msg.severity === 'error').map(format), | ||
| warnings: allMsgs | ||
| .filter(msg => msg.severity === 'warning') | ||
| .map(format), | ||
| }); | ||
| .waiting.tap('awaitingTypeScriptCheck', () => { | ||
| console.log( | ||
| chalk.yellow( | ||
| 'Files successfully emitted, waiting for typecheck results...' | ||
| ) | ||
| ); | ||
| }); | ||
| } | ||
| @@ -180,48 +165,6 @@ function createCompiler({ | ||
| errors: true, | ||
| }); | ||
| if (useTypeScript && statsData.errors.length === 0) { | ||
| const delayedMsg = setTimeout(() => { | ||
| console.log( | ||
| chalk.yellow( | ||
| 'Files successfully emitted, waiting for typecheck results...' | ||
| ) | ||
| ); | ||
| }, 100); | ||
| const messages = await tsMessagesPromise; | ||
| clearTimeout(delayedMsg); | ||
| if (tscCompileOnError) { | ||
| statsData.warnings.push(...messages.errors); | ||
| } else { | ||
| statsData.errors.push(...messages.errors); | ||
| } | ||
| statsData.warnings.push(...messages.warnings); | ||
| // Push errors and warnings into compilation result | ||
| // to show them after page refresh triggered by user. | ||
| if (tscCompileOnError) { | ||
| stats.compilation.warnings.push(...messages.errors); | ||
| } else { | ||
| stats.compilation.errors.push(...messages.errors); | ||
| } | ||
| stats.compilation.warnings.push(...messages.warnings); | ||
| if (messages.errors.length > 0) { | ||
| if (tscCompileOnError) { | ||
| devSocket.warnings(messages.errors); | ||
| } else { | ||
| devSocket.errors(messages.errors); | ||
| } | ||
| } else if (messages.warnings.length > 0) { | ||
| devSocket.warnings(messages.warnings); | ||
| } | ||
| if (isInteractive) { | ||
| clearConsole(); | ||
| } | ||
| } | ||
| const messages = formatWebpackMessages(statsData); | ||
| const isSuccessful = !messages.errors.length && !messages.warnings.length; | ||
| if (isSuccessful) { | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should set compilerOptions
tsBuildInfoFile: paths.cacheTsBuildInfoFilein theForkTsCheckerWebpackPlugin