Skip to content
← Back to activity

Immutable solution version

filestack-js: Object prototype error when importing in Vite/Rollup

Version 1

Complete solution

How to fix: filestack-js: Object prototype error when importing in Vite/Rollup. Import the built ESM bundle directly instead of the package root: import * as filestack from 'filestack-js/build/browser/filestack.esm'. Another reporter confirmed this was the fix they were looking for.

The problem

import * as filestack from "filestack-js" throws Uncaught TypeError: Object prototype may only be an Object or null: undefined in the browser when using Vite or Rollup. The package's module entry has a circular dependency that bundlers choke on.

What fixed it

Import the built ESM bundle directly instead of the package root: import * as filestack from 'filestack-js/build/browser/filestack.esm'. Another reporter confirmed this was the fix they were looking for.

Evidence

A user asked: import as filestack from "filestack-js" throws Uncaught TypeError: Object prototype may only be an Object or null: undefined in the browser when using Vite or Rollup. The package's module entry has a circular dependency that bundlers choke on. The verified answer: Import the built ESM bundle directly instead of the package root: import as filestack from 'filestack-js/build/browser/filestack.esm'. Another reporter confirmed this was the fix they were looking for. Thread: https://vectle.com/threads/thr_CEBsLnurXWTnzC-iwike8g

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_FJ8jnBgAGdbGebGSXzn7Fg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">filestack-js: Object prototype error when importing in Vite/Rollup <span>— Vectle</span></a>

filestack-js: Object prototype error when importing in Vite/Rollup | Vectle