[error] [nitro] RollupError: Expected ',', got 'undefined' in /opt/buildhome/repo/node_modules/papap

Hello ! currently working with Papaparse and trying to deploy to cloudflare pages :
[log] [nuxi] Nuxt 4.0.1 with Nitro 2.12.4
22:56:54.801 [warn] [@nuxt/supabase] The `cookieRedirect` option is deprecated, use `saveRedirectToCookie` instead.
22:56:54.802 [warn] [@nuxt/supabase] The `cookieName` option is deprecated, use `cookiePrefix` instead.
22:56:57.242 [info] Nuxt Icon server bundle mode is set to `remote`
22:56:57.405 [info] [nuxi] Building for Nitro preset: `cloudflare-pages`
22:56:58.330 [info] Building client...
22:56:58.350 [info] vite v7.0.5 building for production
[log] [nuxi] Nuxt 4.0.1 with Nitro 2.12.4
22:56:54.801 [warn] [@nuxt/supabase] The `cookieRedirect` option is deprecated, use `saveRedirectToCookie` instead.
22:56:54.802 [warn] [@nuxt/supabase] The `cookieName` option is deprecated, use `cookiePrefix` instead.
22:56:57.242 [info] Nuxt Icon server bundle mode is set to `remote`
22:56:57.405 [info] [nuxi] Building for Nitro preset: `cloudflare-pages`
22:56:58.330 [info] Building client...
22:56:58.350 [info] vite v7.0.5 building for production
I ended up using :
replace: {
'typeof window': '`undefined`',
}
replace: {
'typeof window': '`undefined`',
}
In my nuxt.config.ts it does not feels right. Any clean solution ahead ? The main issue is explained here: https://github.com/mholt/PapaParse/issues/1056 Thanks for your help
GitHub
RollupError when deploying to Cloudflare · Issue #1056 · mholt/Pa...
11:23:00.516 [error] [nitro] RollupError: Expected ',', got 'undefined' in /opt/buildhome/repo/node_modules/papaparse/papaparse.js 11:23:00.516 11:23:00.516 11:23:00.516 50: var URL...
2 Replies
kapa.ai
kapa.ai2mo ago
Hi @gabrielstuff. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The knowledge sources do not contain specific information about integrating PapaParse with Nuxt 4 or handling the Rollup error you encountered when deploying to Cloudflare Pages. There is also no official documentation or recommended workaround for the PapaParse issue or the use of the Rollup replace plugin in this context. However, your approach of using the replace option in your nuxt.config.ts to handle the typeof window issue is a common workaround for libraries that are not fully SSR-compatible or expect a browser environment. While it may not feel ideal, this is a standard way to patch such issues in the build process, especially when targeting serverless or edge environments like Cloudflare Pages. If you are looking for a more "Nuxt-native" or clean solution, the knowledge sources do not provide an alternative. You may want to monitor the PapaParse issue you referenced for updates or consider using a different CSV parsing library that is fully compatible with SSR and modern build tools. If you encounter further build issues related to Nitro or deployment presets, make sure you are using the latest versions of Nuxt and Nitro, as several deployment-related bugs have been fixed in recent releases, especially for Cloudflare Pages deployments Cloudflare Pages Static v2.12.0 Nitro Deployment Fail, nuxt generate fails with Nuxt 4.0. In summary:
- Your workaround is valid given the current state of the ecosystem. - There is no official "cleaner" solution documented in the knowledge sources. - Keep your dependencies up to date to benefit from the latest fixes. If you need further help, you may want to open an issue on the Nuxt repository or follow the PapaParse issue for updates. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@213659913149218817> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?