Skip to content
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

refactor: some improvements for webpack-dev-server #5815

Merged
merged 2 commits into from
Oct 29, 2021
Merged

Conversation

lex111
Copy link
Contributor

@lex111 lex111 commented Oct 28, 2021

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.)

@lex111 lex111 added the pr: polish This PR adds a very minor behavior improvement that users will enjoy. label Oct 28, 2021
@lex111 lex111 requested a review from slorber as a code owner October 28, 2021 18:05
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Oct 28, 2021
@@ -182,17 +185,16 @@ export default async function start(
devMiddleware: {
publicPath: baseUrl,
// Reduce log verbosity, see https://github.com/facebook/docusaurus/pull/5420#issuecomment-906613105
stats: 'errors-warnings',
stats: 'summary',
Copy link
Contributor Author

@lex111 lex111 Oct 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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&quot;,&quot;width&quot;:&quot;14&quot;,&quot;height&quot;:&quot;16&quot;,&quot;viewBox&quot;:&quot;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

hot: cliOptions.hotOnly ? 'only' : true,
liveReload: false,
Copy link
Contributor Author

@lex111 lex111 Oct 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We always use hot, so liveReload is useless, so maybe it make sense to disable it explicitly?

usePolling: !!cliOptions.poll,
interval: Number.isInteger(cliOptions.poll)
? (cliOptions.poll as number)
: undefined,
};
const fsWatcher = chokidar.watch(pathsToWatch, {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

watch accepts chokidar options, and it seems to make sense to pass interval in addition to usePolling.

@netlify
Copy link

netlify bot commented Oct 28, 2021

✔️ [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

@github-actions
Copy link

github-actions bot commented Oct 28, 2021

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟢 Performance 92
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5815--docusaurus-2.netlify.app/

@github-actions
Copy link

Size Change: -6 B (0%)

Total Size: 847 kB

ℹ️ View Unchanged
Filename Size Change
website/.docusaurus/globalData.json 38 kB 0 B
website/build/assets/css/styles.********.css 94 kB 0 B
website/build/assets/js/main.********.js 425 kB 0 B
website/build/blog/2017/12/14/introducing-docusaurus/index.html 68.2 kB 0 B
website/build/blog/index.html 39 kB 0 B
website/build/docs/index.html 46.1 kB -3 B (0%)
website/build/docs/installation/index.html 53.6 kB -3 B (0%)
website/build/index.html 31.6 kB 0 B
website/build/tests/docs/index.html 27.3 kB 0 B
website/build/tests/docs/standalone/index.html 23.8 kB 0 B

compressed-size-action

@slorber
Copy link
Collaborator

slorber commented Oct 29, 2021

LGTM 👍 thanks

@slorber slorber merged commit d1fa1b5 into main Oct 29, 2021
@slorber slorber deleted the lex111/wds-4-imp branch October 29, 2021 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: polish This PR adds a very minor behavior improvement that users will enjoy.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants