Hot-reload isn't working with .mdx files
See original GitHub issueDescription
Whenever running gatsby develop
, it runs perfectly on the first try and hot-reloads the content if I’m updating page files or other components (.ts or .tsx files).
However, if I try to update an .mdx file, the process just hangs in the “Re-building development bundle” step; if i add the --verbose
tag when running gatsby develop, it hangs on “Transition to recompiling” indefinitely. Only by cancelling the rebuild process and starting it again I can see the rebuilt content.
Steps to reproduce
- Run Gatsby Develop
- Wait for the bundle to finish building and for the server to fully load
- Make a change to a .mdx file
Expected result
The development server should rebuild the development bundle and update the page content accordingly.
Actual result
The process hangs in the Transition to Recompiling step
during the rebuild. If running Gatsby develop with verbose on, the log is the following:
verbose Webpack file changed: /Users/danielpereira/Documents/gatsby-project/src/docs/users/index.mdx
verbose Transition to "waiting" > "aggregatingFileChanges"
verbose Transition to "waiting" > "batchingNodeMutations"
verbose Transition to "waiting" > "committingBatch"
verbose Transition to "waiting" > "rebuild"
verbose Transition to "recreatingPages"
success building schema - 0.262s
verbose Transition to "recreatingPages" > "creatingPages"
info Total nodes: 119, SitePage nodes: 13 (use --verbose for breakdown)
verbose Number of node types: 9. Nodes per type: SitePage: 13, SitePlugin: 48, Site: 1, SiteBuildMetadata: 1, Directory: 13, File: 29, ImageSharp: 7, HomepageJson: 2, Mdx: 5
success createPages - 0.010s
verbose Checking for deleted pages
verbose Deleted 0 pages
verbose Found 0 changed pages
success Checking for changed pages - 0.003s
verbose Transition to "recreatingPages" > "rebuildingSchemaWithSitePage"
success update schema - 0.028s
verbose Transition to "recreatingPages" > "done"
verbose Transition to "runningQueries"
success onPreExtractQueries - 0.003s
success extract queries from components - 0.097s
verbose Transition to "runningQueries" > "waitingPendingQueries"
verbose Transition to "runningQueries" > "writingRequires"
success write out requires - 0.004s
verbose Transition to "runningQueries" > "calculatingDirtyQueries"
verbose Transition to "runningQueries" > "runningStaticQueries"
verbose Transition to "runningQueries" > "runningPageQueries"
verbose Transition to "runningQueries" > "waitingForJobs"
verbose Transition to "runningQueries" > "done"
verbose Transition to "recompiling"
not finished Re-building development bundle - 409.860s
Environment
System: OS: macOS 10.15.6 CPU: (8) x64 Intel® Core™ i7-4770HQ CPU @ 2.20GHz Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.13.0 - ~/.nvm/versions/node/v12.13.0/bin/node Yarn: 1.22.4 - /usr/local/bin/yarn npm: 6.12.0 - ~/.nvm/versions/node/v12.13.0/bin/npm Languages: Python: 3.8.3 - /Users/danielpereira/.pyenv/shims/python Browsers: Chrome: 86.0.4240.198 Firefox: 81.0.2 Safari: 13.1.2 npmPackages: gatsby: ^2.24.57 => 2.26.1 gatsby-alias-imports: ^1.0.4 => 1.0.6 gatsby-image: ^2.2.44 => 2.5.0 gatsby-plugin-emotion: ^4.2.0 => 4.4.0 gatsby-plugin-eslint: ^2.0.8 => 2.0.8 gatsby-plugin-google-analytics: ^2.3.14 => 2.5.0 gatsby-plugin-google-marketing-platform: ^0.1.21 => 0.1.21 gatsby-plugin-google-tagmanager: ^2.3.12 => 2.5.0 gatsby-plugin-manifest: ^2.2.48 => 2.6.0 gatsby-plugin-mdx: ^1.2.47 => 1.4.0 gatsby-plugin-offline: ^3.0.41 => 3.4.0 gatsby-plugin-preload-fonts: ^1.2.2 => 1.3.0 gatsby-plugin-react-helmet: ^3.1.24 => 3.4.0 gatsby-plugin-react-svg: ^3.0.0 => 3.0.0 gatsby-plugin-robots-txt: ^1.5.1 => 1.5.3 gatsby-plugin-sass: ^2.2.1 => 2.5.1 gatsby-plugin-sharp: ^2.6.3 => 2.8.0 gatsby-plugin-sitemap: ^2.4.12 => 2.6.0 gatsby-plugin-stylelint: ^3.2.0 => 3.2.0 gatsby-plugin-tslint: ^0.0.2 => 0.0.2 gatsby-plugin-typescript: ^2.3.1 => 2.6.0 gatsby-plugin-typescript-checker: ^1.1.1 => 1.1.1 gatsby-source-filesystem: ^2.3.35 => 2.5.0 gatsby-transformer-json: ^2.3.1 => 2.5.0 gatsby-transformer-remark: ^2.7.1 => 2.10.0 gatsby-transformer-sharp: ^2.3.19 => 2.6.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top GitHub Comments
I was able to reproduce this (including when upgrading to 2.28). It seems like there’s an infinite loop in your code somewhere which gets triggered on re-compilation. There’s a lot of code in your reproduction so it’s hard to know for sure if it’s something in your code or it’s a gatsby/gatsby-plugin-mdx problem. Could you please remove all code from the reproduction that isn’t directly related to triggering the problem? Ideally a reproduction only has 1-2 files in it.
I’m closing this in favor of https://github.com/gatsbyjs/gatsby/issues/30062 as this issue here hasn’t got a minimal reproduction and the behavior might have changed with Gatsby v3.