Vuejs Vite pwa build error

My was static website was deployed for a few month with no issue and I just added a new files in my store folder and since then there is an issue during deployment. These are the logs:
vite v5.4.8 building for production…
transforming…
✓ 1028 modules transformed.
x Build failed in 8.55s
error during build:
[vite-plugin-pwa:build] Could not load /opt/render/project/src/src/backend/LivestreamApi (imported by src/stores/livestreams.ts): ENOENT: no such file or directory, open ‘/opt/render/project/src/src/backend/LivestreamApi’
at async open (node:internal/fs/promises:639:25)
at async Object.readFile (node:internal/fs/promises:1249:14)
at async Object.load (file:///opt/render/project/src/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:65034:25)
at async PluginDriver.hookFirstAndGetPlugin (file:///opt/render/project/src/node_modules/rollup/dist/es/shared/node-entry.js:20630:28)
at async file:///opt/render/project/src/node_modules/rollup/dist/es/shared/node-entry.js:19750:33
at async Queue.work (file:///opt/render/project/src/node_modules/rollup/dist/es/shared/node-entry.js:20840:32)
ERROR: “build-only” exited with 1.
==> Build failed :disappointed:
==> Common ways to troubleshoot your deploy: https://docs.render.com/troubleshooting-deploys

I see that in the path there is src/src it could be the issue. this is my livestream.ts file:
import { defineStore } from ‘pinia’
import LivestreamApi from ‘@/backend/LivestreamApi’
import type { Livestream } from ‘@/interfaces/Livestream’

export const useLivestreamStore = defineStore(‘livestream’, {
state: () => ({
livestreams: as Livestream,
livestream: {} as Livestream,
next: {} as Livestream
}),
actions: {
async fetchNextLivestream() {
const response = await LivestreamApi.next()
this.next = response.data
return response
}
},
getters: {}
})

In every store file I import api files in the exact same manner. I don’t see where the issue could be from.

I can’t verify this because I don’t have access to your repository, but the most common problem in this situation is that the file (or folder?) isn’t named exactly LivestreamApi. The filesystem on Linux is case sensitive.

The file is correctly spelled LivestreamApi.ts. It’s in backend folder. I think I will just start a new branch and recreate the files there.

Note that src/src isn’t an issue. Your files are placed in /opt/render/project/src, then your repository has a src folder at the root. Thus:

----- render root ----- | your repository
/opt/render/project/src      /src/[…]

src/src/ is fine and expected assuming your repository has (or creates) a src/ folder at its working root directory.

1 Like

I deleted the files and recreated them in a new branch and it worked