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.

[gatsby-plugin-preact] Can't resolve 'react-dom' for node_modules package

See original GitHub issue

Description

 ERROR #98123  WEBPACK

Generating SSR bundle failed

Can't resolve 'react-dom' in '[...]/node_modules/@tippyjs/react/dist'

Steps to reproduce

  1. npx gatsby new bug-repro
  2. yarn add @tippyjs/react gatsby-plugin-preact
  3. Add the Preact plugin to gatsby.config.js
  4. Edit index.js with
import React from "react"
import { Link } from "gatsby"
import Tippy from "@tippyjs/react"

import Layout from "../components/layout"
import Image from "../components/image"
import SEO from "../components/seo"

const IndexPage = () => (
  <Layout>
    <SEO title="Home" />
    <Tippy content="test">
      <button>test</button>
    </Tippy>
  </Layout>
)

export default IndexPage

Expected result

No error

Actual result

Error

Environment

  System:
    OS: macOS 10.15.3
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 13.12.0 - /usr/local/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 81.0.4044.122
    Firefox: 75.0
    Safari: 13.0.5
  npmPackages:
    gatsby: ^2.20.36 => 2.20.36
    gatsby-image: ^2.2.19 => 2.3.5
    gatsby-plugin-catch-links: ^2.1.9 => 2.2.4
    gatsby-plugin-client-side-redirect: 0.0.2 => 0.0.2
    gatsby-plugin-emotion: ^4.1.18 => 4.2.3
    gatsby-plugin-google-analytics: ^2.1.16 => 2.2.5
    gatsby-plugin-manifest: ^2.2.16 => 2.3.7
    gatsby-plugin-mdx: ^1.1.5 => 1.1.11
    gatsby-plugin-offline: ^3.0.7 => 3.1.5
    gatsby-plugin-preact: ^3.2.4 => 3.2.4
    gatsby-plugin-react-helmet: ^3.1.7 => 3.2.5
    gatsby-plugin-sharp: ^2.2.22 => 2.5.7
    gatsby-redirect-from: ^0.2.1 => 0.2.1
    gatsby-remark-autolink-headers: ^2.1.10 => 2.2.4
    gatsby-remark-vscode: ^2.0.3 => 2.0.3
    gatsby-source-filesystem: ^2.1.22 => 2.2.5
    gatsby-transformer-remark: ^2.6.22 => 2.7.5
    gatsby-transformer-sharp: ^2.2.14 => 2.4.7

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
Grsmtocommented, Apr 28, 2020

You need to add preact to your dependencies as well, not just the plugin.

1reaction
lannonbrcommented, Apr 28, 2020

Ah always the little things, @Grsmto is correct, added preact into my reproduction for this and it works now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't resolve 'react-dom' in '/path/node_modules/gatsby-react ...
You can have this error when moving from Gatsby v1 to v2. There's an official upgrade guide available here: ...
Read more >
Gatsby Changelog | 5.3.0
In PR #36623 we fixed this behavior and any node changes (either by changing local files or through webhook updates) will be reflected...
Read more >
gatsby-plugin-react-svg - npm
Start using gatsby-plugin-react-svg in your project by running `npm i gatsby-plugin-react-svg`. There are 108 other projects in the npm ...
Read more >
Ugrading MDB React Gatsby project to Pro
p>I have a project I build using MDB React and Gatsby using this blog post as a ... Can't resolve 'react-router-dom' in '/Users/viccooper/Desktop/HearRo...
Read more >
the `@emotion/core` package has been renamed to ... - You.com
Module not found: Error: Can't resolve '@emotion/react ... erroring out because it relies upon gatsby-plugin-emotion and @emotion/core , the latter of which ...
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