Next.js Discord

Discord Forum

Cannot use 'export import' on a type or type-only namespace when 'isolatedModules' is enabled.

Unanswered
sarif posted this in #help-forum
Open in Discord
Experiencing the error in the title when running next build, and it's preventing me from deploying to Vercel as well. The code runs fine in development. I attached my .eslintrc, package.json, and tsconfig.json in case any are relevant. You can check my package.json for package versions. Here is the exact error I get:

PS C:\Users\sarif\Documents\GitHub\x> npm run build

> x@0.1.0 build
> next build

   ▲ Next.js 15.1.3
   - Environments: .env

   Creating an optimized production build ...
 ✓ Compiled successfully
   Linting and checking validity of types  ..Failed to compile.

./node_modules/@browserbasehq/sdk/src/index.ts:183:3
Type error: Cannot use 'export import' on a type or type-only namespace when 'isolatedModules' is enabled.

  181 |
  182 | export namespace Browserbase {
> 183 |   export import RequestOptions = Core.RequestOptions;
      |   ^
  184 |
  185 |   export import Contexts = API.Contexts;
  186 |   export import Context = API.Context;
Static worker exited with code: 1 and signal: null
PS C:\Users\samee\Documents\GitHub\x>


I've tried:
* Deleting and re-installing node_modules (using both npm and pnpm)
* Reverting next, react, and eslint to older versions from a similar project that works.
* Setting isolatedModules to false. Next.js overrides it back to true when you run build

I think that the error could be prevented by making it not check types inside of node_modules, but I have it excluded in my tsconfig and eslint config and I still get this error. Pretty sure nextjs just overrides the config. Any help would be greatly appreciated.

0 Replies