SvelteKit build error: Node modules could not be resolved
Hi, I have a SvelteKit project with
googleapis
package installed. I tried deploying it to Pages with cloudflare adapter but the build failed with errors like the following:
I have googled around and deduce that the problem is these core node modules need to be polyfilled (cmiiw). I have tried various polyfilling packages that I could find on Google (vite-plugin-node-polyfills
, @esbuild-plugins/node-globals-polyfill
, @esbuild-plugins/node-modules-polyfill
), however none seems to be solving the problem. Is there any solution for this? I use googleapis
to utilize the Google Sheets API to retrieve data from a spreadsheet2 Replies
I also have this problem. I want to be able to move my sveltekit project from vercel to pages, but just isn't working as I have tried multiple different polyfills and approaches. Pages are not that useful in a node.js project if you cannot use some of the node core packages.
Have anyone gotten this to work with polyfills, like ever?
I think easiest route for you is to use the http API and not rely on googleapi library