#Solid-start-vercel rollup error

36 messages · Page 1 of 1 (latest)

glad olive
#

Hey, I am trying to build my solidstart app with solid-start-vercel package included (it works just fine without it) and I am getting this error base = Object.assign(new Error(base.message), base);23:18:46 ^23:18:4623:18:46Error [RollupError]: Module format "cjs" does not support top-level await. Use the "es" or "system" output formats rather.23:18:46 at error (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:2245:30)23:18:46 at Module.render (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:13883:20)23:18:46 at Chunk.renderModules (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:16335:41)23:18:46 at Chunk.render (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:15843:111)23:18:46 at file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:17480:7223:18:46 at Array.map (<anonymous>)23:18:46 at renderChunks (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:17480:53)23:18:46 at Bundle.generate (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:17702:19)23:18:46 at async file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:26543:2723:18:46 at async catchUnfinishedHookActions (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:25676:16)23:18:46 at async Object.build (file:///vercel/path0/node_modules/solid-start-vercel/index.js:183:7) {23:18:46 code: 'INVALID_TLA_FORMAT',23:18:46 id: '/vercel/path0/.solid/server/entry-server.js'23:18:46}23:18:4623:18:46Node.js v18.15.023:18:46Error: Command "npm run build" exited with 123:18:46BUILD_UTILS_SPAWN_1: Command "npm run build" exited with 1

I tried to search online and also in this DC server but haven't found anything quite like it. I know solid-start-vercel is experimental, I just couldn't manage to make my app work on vercel without it.
Thanks for help in advance.

#

Solid-start-vercel rollup error

native ravine
glad olive
#
 import vercel from "solid-start-vercel" 
 import suidPlugin from "@suid/vite-plugin"; 
 import { defineConfig } from "vite"; 
  
 export default defineConfig(() => { return { 
   plugins: [ 
     solid({ssr:false, adapter: vercel() }),  
     suidPlugin()], 
 }})```
#

I could also share package.json or tsconfig if it were to help

native ravine
glad olive
#

package.json

   "name": "testproj", 
   "scripts": { 
     "dev": "solid-start dev", 
     "build": "solid-start build", 
     "start": "solid-start start" 
   }, 
   "type": "module", 
   "devDependencies": { 
     "@types/node": "^18.11.18", 
     "esbuild": "^0.14.54", 
     "postcss": "^8.4.21", 
     "solid-start-node": "^0.2.26",
     "solid-start-vercel": "^0.2.26", 
     "typescript": "^4.9.4", 
     "vite": "^4.3.9", 
     "zod": "^3.21.4" 
   }, 
   "dependencies": { 
     "@solidjs/meta": "^0.28.2", 
     "@solidjs/router": "^0.8.2", 
     "@suid/icons-material": "^0.6.1", 
     "@suid/material": "^0.12.1", 
     "@suid/vite-plugin": "^0.1.3", 
     "@trpc/client": "^10.18.0", 
     "@trpc/server": "^10.18.0", 
     "googleapis": "^118.0.0", 
     "solid-icons": "^1.0.4", 
     "solid-js": "^1.6.11", 
     "solid-masonry": "^0.1.6", 
     "solid-start": "^0.2.26", 
     "solid-start-trpc": "^0.0.16",  
     "undici": "^5.15.1" 
   }, 
   "engines": { 
     "node": ">=18.16.1" 
   } 
 } ```
#

tsconfig

   "compilerOptions": { 
     "allowSyntheticDefaultImports": true, 
     "esModuleInterop": true, 
     "resolveJsonModule": true, 
     "target": "ESNext", 
     "module": "ESNext", 
     "moduleResolution": "node", 
     "jsxImportSource": "solid-js", 
     "jsx": "preserve", 
     "strict": true, 
     "types": ["solid-start/env"], 
     "baseUrl": "./", 
     "paths": { 
       "~/*": ["./src/*"] 
     } 
   }
 } ```
native ravine
#

Does dev mode work?

glad olive
#

Yeah, but I forgot I have edited vite config since I tried it in dev mode

#

I just updated it, one change, ssr set to false

native ravine
#

Where are you using your googleapis dependency?

#

Since it's nodejs only

glad olive
#

On the server side, I am using it for authorization

native ravine
#

awesome

#

You may be able to add this build: { target: "esnext" } to your config

#

Or rollupOptions: { output: { format: "es" } }

#

It looks like one of your deps is cjs, but I've checked all of them on npm and they all seem to be es compatible

glad olive
#

Yeah, I have already tried both of these

native ravine
#

I can't reproduce a build issue with your exact package.json, tsconfig, and vite config

glad olive
# native ravine Huh

I had the same thought, tried to make rollup produce "es" instead of "csj" output, but none of these made any change

native ravine
#

Maybe try removing dependencies one by one, and you might eventually find what dep causes it

glad olive
#

Maybe I'll try clearing node modules and package lock

native ravine
glad olive
#

So clearing didn't help, I went one by one

#

As I mention in original post, not using vercel as adapter makes it work

#

And when using vercel as adapter removing googlapis makes it work

#

I guess problem is somewhere between them, I'll try to find out, but at least I have some direction

#

Thank you for your help

native ravine
native ravine
glad olive
#

If it is the case I might simply stop using the googlapis package, I can probably write the auth routine without it

glad olive
#

Solved the issue - it was indeed the googlapis, not the package itself, but the way I used it, one async call was outside of class and got to the top level during rollup processing. Thanks, you helped me a lot