question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(v2) react-loadable-ssr-addon getBundles error

See original GitHub issue

🐛 Bug Report

Running docusaurus build in a project with swizzled DocItem and DocPage components throws an when server code is being evaluated.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

  1. Create a new project using @docusaurus/init with classic template
  2. Remove blog directory
  3. yarn docusaurus swizzle @docusaurus/theme-classic DocItem
  4. yarn docusaurus swizzle @docusaurus/theme-classic DocPage
  5. Run yarn build

Expected behavior

docusaurus build to finish successfully

Actual Behavior

Failed CI logs

$ docusaurus build
Creating an optimized production build...
[info] [webpackbar] Compiling Client
[info] [webpackbar] Compiling Server
[success] [webpackbar] Client: Compiled successfully in 12.23s
[success] [webpackbar] Server: Compiled with some errors in 13.57s

(undefined) TypeError: Cannot convert undefined or null to object

    at Function.keys (<anonymous>)
TypeError: Cannot convert undefined or null to object
    at main:19364:12
    at Array.reduce (<anonymous>)
    at getBundles (main:19363:20)
    at serverEntry_render (main:35231:113)
(undefined) TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at main:19364:12
    at Array.reduce (<anonymous>)
    at getBundles (main:19363:20)
    at serverEntry_render (main:35231:113)
(undefined) TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at main:19364:12
    at Array.reduce (<anonymous>)
    at getBundles (main:19363:20)
    at serverEntry_render (main:35231:113)
(undefined) TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at main:19364:12
    at Array.reduce (<anonymous>)
    at getBundles (main:19363:20)
    at serverEntry_render (main:35231:113)
(undefined) TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at main:19364:12
    at Array.reduce (<anonymous>)
    at getBundles (main:19363:20)
    at serverEntry_render (main:35231:113)
Error: Failed to compile with errors.
    at /home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/@docusaurus/core/lib/commands/build.js:38:24
    at finalCallback (/home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/webpack/lib/MultiCompiler.js:254:12)
    at /home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/webpack/lib/MultiCompiler.js:277:6
    at done (/home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/neo-async/async.js:2931:13)
    at runCompilers (/home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/webpack/lib/MultiCompiler.js:181:48)
    at /home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/webpack/lib/MultiCompiler.js:188:7
    at /home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/webpack/lib/MultiCompiler.js:270:7
    at finalCallback (/home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/webpack/lib/Compiler.js:257:39)
    at /home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/webpack/lib/Compiler.js:273:13
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:42:1)
    at AsyncSeriesHook.lazyCompileHook (/home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/tapable/lib/Hook.js:154:20)
    at onCompiled (/home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/webpack/lib/Compiler.js:271:21)
    at /home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/webpack/lib/Compiler.js:681:15
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/tapable/lib/Hook.js:154:20)
    at /home/runner/work/docusaurus-issue/docusaurus-issue/node_modules/webpack/lib/Compiler.js:678:31
    at Function.keys (<anonymous>)
    at Array.reduce (<anonymous>)TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at Array.reduce (<anonymous>)TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at Array.reduce (<anonymous>)TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at Array.reduce (<anonymous>)TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at Array.reduce (<anonymous>)

Your Environment

  • Docusaurus version used: 2.0.0-alpha.56
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node.js v14.3.0
  • Operating system and version (desktop or mobile): Linux

Reproducible Demo

https://github.com/ark120202/docusaurus-issue

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
ark120202commented, Jun 9, 2020

I have tried it on the repository where I have found that issue originally (https://github.com/ModDota/moddota.github.io/commit/ddd4b3a2ff3a9ae14603240588ba6c4456f4fc25)

1reaction
ark120202commented, Jun 9, 2020

Yes, this patch also makes it work for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Loadable SSR isn't always giving client complete list of ...
The problem is that react-loadable only sees that it needs the about bundle, not the extra bundle containing moment-timezone.
Read more >
react-loadable-s - npm Package Health Analysis - Snyk
Code-splitting is the process of taking one large bundle containing your entire app, and splitting them up into multiple smaller bundles which ...
Read more >
Bundle splitting using react-loadable - Toni-Develops
This is happening since Babel doesn't have the appropriate plug-in to transpile dynamic imports. Let's fix this by installing 'plugin-syntax- ...
Read more >
An introduction to Webpack Code-Splitting, Loadable ...
So, you have a React application, understand the performance and therefore ... to 'bundles', but each bundle has the extension '.chunk.js'.
Read more >
React Loadable:
We've tried and failed a couple of times. What we learned: ❏ You need synchronous module resolution on the server so you can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found