-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
fix(v2): force terminate building if client bundle failed #2345
Conversation
5e3582b
to
390916c
Compare
@@ -30,6 +31,26 @@ export function createClientConfig(props: Props): Configuration { | |||
runtimeChunk: true, | |||
}, | |||
plugins: [ | |||
// Plugin to force terminate building if errors happened in the client bundle |
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.
Perhaps this tiny plugin needs to be created in a separate file or class (in same file), but not sure about it. But feel free to change that. Something like ClientBundleCheckerPlugin
??
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.
fix(v2) -> chore(v2) ?
Not sure exactly how the type of commit here accurately reflects the situation...
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.
Perhaps this tiny plugin needs to be created in a separate file or class (in same file), but not sure about it. But feel free to change that. Something like
ClientBundleCheckerPlugin
??
I feel like you are right here. It can be made a separate plugin. Don't wish to take away your thunder and all your hard work on this but I can try do that if you want? :)
Deploy preview for docusaurus-2 ready! Built with commit d2e4f14 |
390916c
to
0e81395
Compare
@@ -4,6 +4,8 @@ | |||
* This source code is licensed under the MIT license found in the | |||
* LICENSE file in the root directory of this source tree. | |||
*/ | |||
|
|||
import chalk from 'chalk'; |
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.
Although it is recommended that we use the CommonJS module format (import chalk = require('chalk');
) to import chalk, but when using this style, tests will fail with such an error:
`import =` is not supported by @babel/plugin-transform-typescript
Please consider using `import <moduleName> from '<moduleName>';` alongside Typescript's --allowSyntheticDefaultImports option.
It is OK?
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.
Seems like this is a known limitation. That is fine then :)
Motivation
Resolve #2311.
Server build uses the
WaitPlugin
plugin, which waits until a client bundle is created. This wait is infinite, so if the building of client bundle fails, the build process enters idle mode.docusaurus/packages/docusaurus/src/webpack/server.ts
Lines 49 to 52 in 32c1a92
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Prior to this fix, the build process became idle and needed to be killed (for example, by pressing CTRL + C)
Now the build process in case of an error in the client bundle terminated immediately.
Results:
Related PRs
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)