Skip to content
This repository was archived by the owner on Mar 19, 2026. It is now read-only.
This repository was archived by the owner on Mar 19, 2026. It is now read-only.

Uncaught TypeError: n.map is not a function #282

@AntonOfTheWoods

Description

@AntonOfTheWoods

Describe the bug

Including browserslist means a web project will fail to load when built for prod. Obviously works fine with normal vite, and also works fine in dev mode.

Discussed on discord https://discord.com/channels/1171783886200643635/1378605150033412148

Reproduction

https://github.com/AntonOfTheWoods/vite-rolldown-issue

Steps to reproduce

pnpm i && pnpm build && pnpm preview

System Info

System:
    OS: Linux 6.11 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 10.86 GB / 30.60 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 22.15.1 - ~/.asdf/installs/nodejs/22.15.1/bin/node
    npm: 10.9.2 - ~/.asdf/plugins/nodejs/shims/npm
    pnpm: 10.12.2 - ~/.asdf/installs/nodejs/22.15.1/bin/pnpm
  Browsers:
    Chrome: 137.0.7151.119
  npmPackages:
    @vitejs/plugin-react: ^4.4.1 => 4.6.0 
    rolldown-vite:  6.3.21

Used Package Manager

pnpm

Logs

broken code from `browserslist`
    (function() {
        for (var e in r) {
            var t = r[e];
            F.data[e] = {
                name: e,
                versions: g(r[e].versions),
                released: g(r[e].versions.slice(0, -3)),
                releaseDate: r[e].release_date
            },
            C(F.usage.global, e, t.usage_global),
            F.versionAliases[e] = {};
            for (var i = 0; i < t.versions.length; i++) {
                var a = t.versions[i];
                if (a && a.indexOf(`-`) !== -1)
                    for (var o = a.split(`-`), s = 0; s < o.length; s++)
                        F.versionAliases[e][o[s]] = a
            }
        }
        F.nodeVersions = n.map(function(e) {
            return e.version
        })
    }
    )(),

The line from browserslist that appears to fail appears to be https://github.com/browserslist/browserslist/blob/41a3b3c2bf016badd4c9a632ea30533b674a696b/index.js#L1241

index-CQtDsh75.js:9 Uncaught TypeError: n.map is not a function
    at index-CQtDsh75.js:9:111663
    at index-CQtDsh75.js:9:111699
    at index-CQtDsh75.js:1:214
    at index-CQtDsh75.js:15:49067

Validations

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions