parcel: Cannot find module 3emQt ('react-refresh/runtime')

πŸ› bug report

πŸŽ› Configuration (.babelrc, package.json, cli command)

{
  "devDependencies": {
    "@parcel/core": "^2.0.0-nightly.325",
    "@parcel/runtime-react-refresh": "^2.0.0-nightly.327",
    "@parcel/transformer-react-refresh-babel": "^2.0.0-nightly.327",
    "@parcel/transformer-react-refresh-wrap": "^2.0.0-nightly.327",
    "parcel": "^2.0.0-nightly.325"
  },
  "targets": {
    "browser": {
      "context": "browser",
      "distDir": "dist",
      "engines": {
        "browsers": [
          "> 2%",
          "not dead"
        ]
      }
    }
  }
}

πŸ€” Expected Behavior

React-refresh works

😯 Current Behavior

image

πŸ”¦ Context

At some nightly build, HMR with React fast refresh stopped working.

πŸ’» Code Sample

Basic React 16 project

🌍 Your Environment

Software Version(s)
Parcel 2.0.0-nightly.325
Node 12.17.0
Yarn 1.22.4
Operating System MacOS 10.15.5

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 20 (8 by maintainers)

Most upvoted comments

In case you can’t remove the inline scripts, this .parcelrc completely disables React fast refresh:

{
    "extends": "@parcel/config-default",
    "transformers": {
      "*.{js,mjs,jsm,jsx,es6,cjs,ts,tsx}": [
        "@parcel/transformer-babel",
        "@parcel/transformer-js"
      ]
    },
    "runtimes": {
      "browser": [
        "@parcel/runtime-js",
        "@parcel/runtime-browser-hmr"
      ]
    }
}

This is happening for me too in index.html (Parcel 2, 2.0.0-nightly.524)

<script>window.INITIAL_DATA = {...}</script>
<script src="./entry.js"></script>

This gives me an error with React Refresh runtime like OP said. The following β€œfixes” it.

<!-- <script>window.INITIAL_DATA = {...}</script> -->
<script src="./entry.js"></script>

@mischnic Can I mark the script tag to not be processed by parcel? I really need to inject my hack before any other code loaded.