refactor: some improvements for webpack-dev-server - #5815
Conversation
| publicPath: baseUrl, | ||
| // Reduce log verbosity, see https://github.com/facebook/docusaurus/pull/5420#issuecomment-906613105 | ||
| stats: 'errors-warnings', | ||
| stats: 'summary', |
There was a problem hiding this comment.
Perhaps we should use "stats" because the current value duplicates the output in case of error:
Before
SyntaxError: /website/docs/blog.mdx: Expected corresponding JSX closing tag for <MDXLayout>. (14:0)
12 | <p>{`sdfsds`}</p>
13 | <p>{`sdfsd`}</p>
> 14 | </>
| ^
15 | <p>{`The blog feature enables you to deploy in no time a full-featured blog.`}</p>
16 | <div {...{"className":"admonition admonition-info alert alert--info"}}><div parentName="div" {...{"className":"admonition-heading"}}><h5 parentName="div"><span parentName="h5" {...{"className":"admonition-icon"}}><svg parentName="span" {...{"xmlns":"http://www.w3.org/2000/svg","width":"14","height":"16","viewBox":"0 0 14 16"}}><path parentName="svg" {...{"fillRule":"evenodd","d":"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}}></path></svg></span>{`info`}</h5></div><div parentName="div" {...{"className":"admonition-content"}}><p parentName="div">{`Check the `}<a parentName="p" {...{"href":"/docs/api/plugins/@docusaurus/plugin-content-blog"}}>{`Blog Plugin API Reference documentation`}</a>{` for an exhaustive list of options.`}</p></div></div>
17 | <h2 {...{"id":"initial-setup"}}>{`Initial setup`}</h2>
ERROR in ./docs/blog.mdx
Module build failed (from ../packages/docusaurus-mdx-loader/lib/index.js):
SyntaxError: /website/docs/blog.mdx: Expected corresponding JSX closing tag for <MDXLayout>. (14:0)
12 | <p>{sdfsds}</p>
13 | <p>{sdfsd}</p>
> 14 | </>
| ^
15 | <p>{The blog feature enables you to deploy in no time a full-featured blog.}</p>
16 | <div {...{"className":"admonition admonition-info alert alert--info"}}><div parentName="div" {...{"className":"admonition-heading"}}><h5 parentName="div"><span parentName="h5" {...{"className":"admonition-icon"}}><svg parentName="span" {...{"xmlns":"http://www.w3.org/2000/svg","width":"14","height":"16","viewBox":"0 0 14 16"}}><path parentName="svg" {...{"fillRule":"evenodd","d":"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}}></path></svg></span>{info}</h5></div><div parentName="div" {...{"className":"admonition-content"}}><p parentName="div">{Check the }<a parentName="p" {...{"href":"/docs/api/plugins/@docusaurus/plugin-content-blog"}}>{Blog Plugin API Reference documentation}</a>{ for an exhaustive list of options.}</p></div></div>
17 | <h2 {...{"id":"initial-setup"}}>{Initial setup}</h2>
at Object._raise (/node_modules/@babel/parser/lib/index.js:510:17)
at Object.raiseWithData (/node_modules/@babel/parser/lib/index.js:503:17)
at Object.raise (/node_modules/@babel/parser/lib/index.js:464:17)
at Object.jsxParseElementAt (/node_modules/@babel/parser/lib/index.js:7219:14)
at Object.jsxParseElement (/node_modules/@babel/parser/lib/index.js:7248:17)
at Object.parseExprAtom (/node_modules/@babel/parser/lib/index.js:7255:19)
at Object.parseExprSubscripts (/node_modules/@babel/parser/lib/index.js:11217:23)
at Object.parseUpdate (/node_modules/@babel/parser/lib/index.js:11197:21)
at Object.parseMaybeUnary (/node_modules/@babel/parser/lib/index.js:11172:23)
at Object.parseMaybeUnaryOrPrivate (/node_modules/@babel/parser/lib/index.js:10986:59)
at Object.parseExprOps (/node_modules/@babel/parser/lib/index.js:10993:23)
at Object.parseMaybeConditional (/node_modules/@babel/parser/lib/index.js:10963:23)
at Object.parseMaybeAssign (/node_modules/@babel/parser/lib/index.js:10926:21)
at /node_modules/@babel/parser/lib/index.js:10888:39
at Object.allowInAnd (/node_modules/@babel/parser/lib/index.js:12720:12)
at Object.parseMaybeAssignAllowIn (/node_modules/@babel/parser/lib/index.js:10888:17)
client compiled with 1 error
After
SyntaxError: /home/lex/repos/docusaurus/website/docs/blog.mdx: Expected corresponding JSX closing tag for <MDXLayout>. (14:0)
12 | <p>{`sdfsds`}</p>
13 | <p>{`sdfsd`}</p>
> 14 | </>
| ^
15 | <p>{`The blog feature enables you to deploy in no time a full-featured blog.`}</p>
16 | <div {...{"className":"admonition admonition-info alert alert--info"}}><div parentName="div" {...{"className":"admonition-heading"}}><h5 parentName="div"><span parentName="h5" {...{"className":"admonition-icon"}}><svg parentName="span" {...{"xmlns":"http://www.w3.org/2000/svg","width":"14","height":"16","viewBox":"0 0 14 16"}}><path parentName="svg" {...{"fillRule":"evenodd","d":"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}}></path></svg></span>{`info`}</h5></div><div parentName="div" {...{"className":"admonition-content"}}><p parentName="div">{`Check the `}<a parentName="p" {...{"href":"/docs/api/plugins/@docusaurus/plugin-content-blog"}}>{`Blog Plugin API Reference documentation`}</a>{` for an exhaustive list of options.`}</p></div></div>
17 | <h2 {...{"id":"initial-setup"}}>{`Initial setup`}</h2>
client (webpack 5.60.0) compiled with 1 error
| const devServerConfig: WebpackDevServer.Configuration = { | ||
| compress: true, | ||
| hot: cliOptions.hotOnly ? 'only' : true, | ||
| liveReload: false, |
There was a problem hiding this comment.
We always use hot, so liveReload is useless, so maybe it make sense to disable it explicitly?
| ? (cliOptions.poll as number) | ||
| : undefined, | ||
| }; | ||
| const fsWatcher = chokidar.watch(pathsToWatch, { |
There was a problem hiding this comment.
watch accepts chokidar options, and it seems to make sense to pass interval in addition to usePolling.
|
✔️ [V2] 🔨 Explore the source changes: 0cd6e56 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/617ae8dfcb4edd00083878b0 😎 Browse the preview: https://deploy-preview-5815--docusaurus-2.netlify.app |
|
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-5815--docusaurus-2.netlify.app/ |
|
Size Change: -6 B (0%) Total Size: 847 kB ℹ️ View Unchanged
|
|
LGTM 👍 thanks |
Motivation
Just some improvements after upgrade webpack-dev-server
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Local build
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.)