Skip to content

Error: Bundles must have unique names #6433

@jsjoeio

Description

@jsjoeio

🐛 bug report

During the migration from v1 to v2, Parcel seems to be unhappy with my bundles and I'm not sure why (nor sure how to fix them).

🎛 Configuration (.babelrc, package.json, cli command)

Not using a .babelrc file but heres' the code:

v1

  parcel build \
    --public-url "." \
    --out-dir dist \
    $([[ $MINIFY ]] || echo --no-minify) \
    src/browser/register.ts \
    src/browser/serviceWorker.ts \
    src/browser/pages/login.ts \
    src/browser/pages/vscode.ts

v2

  parcel build \
    --public-url "." \
    --dist-dir dist \
    $([[ $MINIFY ]] || echo --no-optimize) \
    src/browser/register.ts \
    src/browser/serviceWorker.ts \
    src/browser/pages/login.ts \
    src/browser/pages/vscode.t

🤔 Expected Behavior

Parcel 2 should bundle the files like Parcel 1 did (assuming the correct changes have been made).

😯 Current Behavior

Parcel is spitting out an error.

🚨 Build failed.
Error: Bundles must have unique names
AssertionError [ERR_ASSERTION]: Bundles must have unique names
    at BundlerRunner.nameBundles (/Users/jp/Dev/code-server/node_modules/@parcel/core/lib/requests/BundleGraphRequest.js:482:23)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async BundlerRunner.bundle (/Users/jp/Dev/code-server/node_modules/@parcel/core/lib/requests/BundleGraphRequest.js:434:5)
    at async RequestTracker.runRequest (/Users/jp/Dev/code-server/node_modules/@parcel/core/lib/RequestTracker.js:694:20)
    at async Parcel._build (/Users/jp/Dev/code-server/node_modules/@parcel/core/lib/Parcel.js:661:25)
    at async Parcel.run (/Users/jp/Dev/code-server/node_modules/@parcel/core/lib/Parcel.js:510:18)
    at async run (/Users/jp/Dev/code-server/node_modules/parcel/lib/cli.js:367:7)

💁 Possible Solution

We thought it was because we had this line inside register.ts

import "./pages/error.css"
import "./pages/global.css"
import "./pages/login.css"

Sadly removing that did not solve the issue.

🔦 Context

We're trying to migrate from v1 to v2 because there are vulnerabilities in v1 and fixing them causing v1 to break so we're in a pickle 😅

💻 Code Sample

We use Parcel to bundle files for code-server (see here).

🌍 Your Environment

Software Version(s)
Parcel ^2.0.0-beta.3.1
Node v14.17.0
npm/Yarn 1.22.10
Operating System macOS Big Sur 11.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions