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.

Generating SSR bundle failed saying it's not possible to compile spread arguments in `super()` without compiling classes

See original GitHub issue

Description

gatsby build is failing with the error:-

error Generating SSR bundle failed
/builds/anant-ag/kompanero/src/components/AddressFormModal.js: 
It's not possible to compile spread arguments in `super()` without compiling classes.

Here’s the screenshot of the build logs:- image

Steps to reproduce

Clone https://github.com/pieh/i29326 and use steps from README of that repo

Expected result

Build should be successful

Actual result

Build failed

Environment

Run gatsby info --clipboard in your project directory and paste the output here.

System: OS: Windows 10 10.0.18363 CPU: (8) x64 Intel® Core™ i5-8250U CPU @ 1.60GHz Binaries: Node: 14.15.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD Languages: Python: 2.7.15 Browsers: Chrome: 88.0.4324.146 Edge: Spartan (44.18362.449.0) npmPackages: gatsby: 2.32.0 => 2.32.0 gatsby-image: 2.11.0 => 2.11.0 gatsby-link: 2.11.0 => 2.11.0 gatsby-plugin-canonical-urls: 2.10.0 => 2.10.0 gatsby-plugin-google-gtag: 2.8.0 => 2.8.0 gatsby-plugin-layout: 1.10.0 => 1.10.0 gatsby-plugin-lunr: 1.5.2 => 1.5.2 gatsby-plugin-manifest: 2.12.0 => 2.12.0 gatsby-plugin-no-sourcemaps: 2.9.0 => 2.9.0 gatsby-plugin-preconnect: ^1.1.54 => 1.1.54 gatsby-plugin-react-helmet: 3.10.0 => 3.10.0 gatsby-plugin-remove-serviceworker: 1.0.0 => 1.0.0 gatsby-plugin-robots-txt: 1.5.5 => 1.5.5 gatsby-plugin-sharp: 2.14.0 => 2.14.0 gatsby-plugin-sitemap: 2.12.0 => 2.12.0 gatsby-source-filesystem: 2.11.0 => 2.11.0 gatsby-source-shopify: 3.10.0 => 3.10.0 gatsby-transformer-sharp: 2.12.0 => 2.12.0 npmGlobalPackages: gatsby-cli: 2.12.91

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:25 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
guilhermebellotticommented, Feb 4, 2021

@guilhermebellotti @babel/plugin-transform-spread is a dependency of babel-preset-gatsby. Just adding it to your own package.json does not mean that 7.12.1 is used. You can see this with npm list/yarn ls.

npm dedup may fix it, or if you are using yarn, add a resolutions field to package.json.

Really! I didn’t know this selection of yarn dependencies. Thanks for the help and clarification!

In the end, I solved it this way:

Run commands

  1. gatsby clean
  2. rm -rf yarn.lock
  3. rm -rf node_modules/
  4. yarn add @babel/plugin-transform-spread@7.12.1

Add resolutions in package.json file

  "resolutions": {
    "@babel/plugin-transform-spread": "7.12.1"
  },

Let’s test! yarn install gatsby build


After correcting this ‘bug’, I will need to remove the resolutions and the dependency "@babel/plugin-transform-spread": "7.12.1", correct @Pessimistress?

9reactions
ghostcommented, Feb 4, 2021

There’s no reproduction needed, all our sites used to build but no longer do.

As @Pessimistress mentioned, @babel/plugin-transform-spread pushed a patch that broke many things, I think Gatsby just needs to lock the version.

The one-line fix is: npm i @babel/plugin-transform-spread@7.12.1

But Gatsby itself badly needs to lock the version otherwise you’re going to get a whole lot of people opening issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gatsby JS - Generating SSR bundle failed - Stack Overflow
It's an extremely broad question and lacks of trials. IE fallback could fail from infinite reasons and pieces of code.
Read more >
Gatsby Changelog | 5.3.0
By using a new <Slice /> React component in combination with a src/slices directory or createSlice API for common UI features, Gatsby will...
Read more >
PyCharm 2019.2 Release Notes | Knowledge Base
No subsystem Bug PY‑36452 Code Insight Feature PY‑33886 Feature PY‑35512 Feature PY‑36009
Read more >
The React Handbook - Medium
The React Handbook follows the 80/20 rule: learn in 20% of the time the 80% of a topic. I find this approach gives...
Read more >
Best practices for a clean and performant Angular application
Over the past few years, our team has been refining our application both in terms of coding standards and performance to make it...
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