Svelte frontend deploy failed while building code

I am making frontend in sveltejs (not sveltekit integration). I am trying to deploy the project in render but deploy is failing at the time of build.
I tried to follow the way mentioned here: Deploy a Svelte Static Site | Render
my configuration is:
/*
“name”: “bdehrfrontend”,
“private”: true,
“version”: “0.0.0”,
“type”: “module”,
“scripts”: {
“dev”: “vite”,
“build”: “vite build”,
“preview”: “vite preview”,
“check”: “svelte-check --tsconfig ./tsconfig.json”
},
/
Error message is:
/

Sep 17 03:22:11 PM [vite-plugin-svelte] performance is not defined
Sep 17 03:22:11 PM file: /opt/render/project/src/src/App.svelte
Sep 17 03:22:11 PM error during build:
Sep 17 03:22:11 PM ReferenceError: performance is not defined
Sep 17 03:22:11 PM at now (file:///opt/render/project/src/node_modules/svelte/src/compiler/Stats.js:1:31)
Sep 17 03:22:11 PM at new Stats (file:///opt/render/project/src/node_modules/svelte/src/compiler/Stats.js:41:21)
Sep 17 03:22:11 PM at compile (file:///opt/render/project/src/node_modules/svelte/src/compiler/compile/index.js:132:16)
Sep 17 03:22:11 PM at compileSvelte (file:///opt/render/project/src/node_modules/@sveltejs/vite-plugin-svelte/src/utils/compile.js:126:20)
Sep 17 03:22:11 PM at async Object.transform (file:///opt/render/project/src/node_modules/@sveltejs/vite-plugin-svelte/src/index.js:220:20)
Sep 17 03:22:11 PM at async transform (file:///opt/render/project/src/node_modules/rollup/dist/es/shared/node-entry.js:24444:16)
Sep 17 03:22:11 PM at async ModuleLoader.addModuleSource (file:///opt/render/project/src/node_modules/rollup/dist/es/shared/node-entry.js:24644:30)
Sep 17 03:22:11 PM ==> Build failed :disappointed:

*/
Please help. TIA

Hi,

The error from the shared deploy logs is:

ReferenceError: performance is not defined

Doing a search for that error + “Svelte” returns several results, one of which is here: Fixing "performance is not defined" Issue with Svelte/SvelteKit :: Casey Primozic's Notes

That seems to suggest the Node version could be an issue here.

You’ve not shared all the deploy logs so I can’t see what Node version you’re using, however, that is shown near the top of the deploys logs, e.g.:

==> Using Node version 14.17.0 (default)
==> Docs on specifying a Node version: https://render.com/docs/node-version

Maybe try setting the Node version to the same one you tested/developed on as a first step.

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.