-
-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Closed
Closed
Webpack5 update [DRAFT] #10656
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
cdb7ec0
Revert "Revert "Update postcss packages" (#10216)"
878f8c4
Merge remote-tracking branch 'upstream/master'
79b16d4
Revert "Update postcss packages" (#10216)
ianschmitz 8d5d16f
Update postcss and loader
0254dc9
Update fork-ts-checker-webpack-plugin@5.2.1
6777da0
Update fork-ts-checker-webpack-plugin 6.0.5
f959414
Add css-minimizer-webpack-plugin@1.1.5 remove
fb56a14
Add support for Webpack 5 message objects
jasonwilliams 48c5456
Update WebpackManifestPlugin to v3.0.0
468ffe6
Support both "SingleEntryPlugin" and "EntryPlugin"
4d0be4a
Support Webpack 5 IgnorePlugin signature
cfee807
Update webpack and dev server
38d72e7
Enable persistent cache
5bef914
Fix react-error-overlay webpack
58d36c2
Fix dev server config
a89a63a
Remove support for SingleEntryPlugin
74ed0c7
update workbox-webpack-plugin
19faf8c
Fix post css config
bbf93d2
Comment out WebpackManifestPlugin for now having issues with undefine…
73c952b
Add fast refresh entries to ModuleScopePlugin
33f9064
Format files
5e79ffa
Remove unused variables in start command
c0e4c4d
git ignore tsconfig.tsbuildinfo
871b2e9
simplify output path
613e2a5
Use asset modules in react-scripts
952f896
Use asset modules in react-error-overlay
2217ab7
Revert "Use asset modules in react-error-overlay"
6eef86c
Disable broken tests for now
0170343
Merge remote-tracking branch 'upstream/wp5' into webpack5-update
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,9 @@ | |
/.pnp | ||
.pnp.js | ||
|
||
# build cache info | ||
tsconfig.tsbuildinfo | ||
|
||
# testing | ||
/coverage | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.cacheTsBuildInfoFile
in theForkTsCheckerWebpackPlugin