I am having an error when deploying a SvelteKit app that uses some Node.js packages in the server. I get this error in the logs:
The package “path” wasn’t found on the file system but is built into node. Are you trying to bundle for node? You can use “platform: ‘node’” to do that, which will remove this error.
So, where do I have to use “platform: 'node”" in my project??
That error is from esbuild and not something you’ll be able to do in Workers (and therefore Pages).
You will need to find a package that doesn’t use Node.js modules like path for compatibility with Pages, or ones that use the node: prefix for imports, and in which case you can use nodejs_compat with a bunch of Node.js modules: Node.js compatibility · Cloudflare Workers docs
Which package(s) are you trying to use? We might be able to suggest some alternatives.