Skip to content

Generated JavaScript file references imports that are not in the importmap #10252

@shepmaster

Description

@shepmaster

🤔 Expected Behavior

The JavaScript does not reference undefined imports.

😯 Current Behavior

The JavaScript fails to load as it tries to import from react/jsx-dev-runtime which isn't defined in the import map.

Uncaught TypeError: Failed to resolve module specifier "react/jsx-dev-runtime". Relative references must start with either "/", "./", or "../".

🔦 Context

In my larger code base, I do use lazy-loading. As far as I can tell, that is intended to create an importmap, but that importmap is missing the entries like those found in this issue. In this issue, there is no import map at all.

💻 Code Sample

package.json

{
  "name": "parcel-repro",
  "version": "0.0.1",
  "dependencies": {
    "react": "19.2.3",
    "react-dom": "19.2.3"
  },
  "devDependencies": {
    "parcel": "2.16.3"
  },
  "engines": {
    "node": "24.12.0",
    "pnpm": "10.27.0"
  }
}

index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <script type="module" src="index.jsx"></script>
  </head>
  <main>
    <body>
      <div id="target"></div>
    </body>
  </main>
</html>

index.jsx

import { createRoot } from 'react-dom/client';

const container = document.getElementById('target');
if (container) {
  const root = createRoot(container);
  root.render(
    <span>Hi</span>,
  );
}

Build the code

pnpm parcel index.html

Visit the site

Visit the dev server in a browser and see that there's a blank page and an error in the console.

You can also look at dist/*.js which starts with the undefined imports:

import * as __parcelExternal0 from "react/jsx-dev-runtime";
import * as __parcelExternal1 from "react-dom/client";

index.html does not define an importmap:

<!DOCTYPE html>
<html lang="en">
    <head>
        <script type="module" src="/repro-clean.4667dcba.js"></script>
    </head>
    <body>
        <main>
            <div id="target"></div>
        </main>
    </body>
</html>

🌍 Your Environment

Software Version(s)
Parcel 2.16.3
Node 24.12.0
pnpm 10.27.0
Operating System macOS 26.1 (25B78)
Browser Chome Version 145.0.7618.0 (Official Build) canary (arm64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions