Skip to content

Build fails with "SyntaxError: Unexpected identifier 'assert'" in @embeddedchat/auth package #1050

@deepak0x

Description

@deepak0x

The build process fails when building the @embeddedchat/auth package due to Rollup not parsing the import assertion syntax in rollup.config.js.

Error Message

Image

✖  @embeddedchat/auth:build
   [!] SyntaxError: Unexpected identifier 'assert'
       at compileSourceTextModule (node:internal/modules/esm/utils:344:16)
       at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:105:18)
       at ModuleLoader.#translate (node:internal/modules/esm/loader:534:12)
       at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:581:27)
       at ModuleJob._link (node:internal/modules/esm/module_job:116:19)

Steps to Reproduce

  1. Clone the repository
  2. Install dependencies: yarn
  3. Run build: yarn build
  4. Build fails on @embeddedchat/auth package

Root Cause

The issue is in packages/auth/rollup.config.js line 4:

import packageJson from './package.json' assert { type: 'json' };

Rollup's parser doesn't support the ESM import assertion syntax (assert { type: 'json' }) when processing the config file, even though Node.js supports it.

Affected Files

  • packages/auth/rollup.config.js (line 4)
  • packages/api/rollup.config.js (line 3) - has the same issue

Environment

  • Node.js Version: v22.16.0
  • Package Manager: Yarn
  • Build Tool: Rollup
  • OS: macOS

Expected Behavior

The build should complete successfully for all packages.

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