Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cverster's avatar

Rebuilding public/build/assets files using Vite

I accidentaly deleted a compiled view file (I'm using Inertia and Vue) in my public/build/assets folder, and now when I try to run either npm run build or npm run dev I get errors telling me that a Javascript file is missing from that folder (this is when vite tries to build my code).

I want to rebuild those files from my view code, but I'm not sure how to do it. Can someone help me out?

0 likes
8 replies
vincent15000's avatar

Which JS file is missing ?

When you run npm run build, you don't need any JS file in the build folder. The folder and its content are created during the execution of this command.

cverster's avatar

@vincent15000 I get the following error message, which mentions the file I deleted:

Could not resolve './Dashboard.2eef028b.js' from public/build/assets/app.543b60d2.js
error during build:
Error: Could not resolve './Dashboard.2eef028b.js' from public/build/assets/app.543b60d2.js
    at error (file:///C:/Users/.../node_modules/rollup/dist/es/shared/rollup.js:1858:30)
    at ModuleLoader.handleResolveId (file:///C:/.../node_modules/rollup/dist/es/shared/rollup.js:22156:24)
    at ModuleLoader.resolveDynamicImport (file:///C:/Users/.../node_modules/rollup/dist/es/shared/rollup.js:22210:120)
    at async file:///C:/Users/.../node_modules/rollup/dist/es/shared/rollup.js:22105:32
1 like
vincent15000's avatar

@cverster Have you deleted all the content of the public folder ? Or just the build folder ? Or only one file ?

cverster's avatar

@vincent15000 Just in the build folder. I also tried to delete all other files in the build folder, but that didn't work either, it just tells me another file is missing.

1 like
vincent15000's avatar

@cverster Try in the local environment. I would test after having deleted all the build folder (not only its content, but also the folder).

cverster's avatar

@vincent15000 I still get the same error unfortunately :( From what I can see it looks like a rollup error =/ But i don't know enough to know where to start looking and haven't found much by searching

1 like
vincent15000's avatar

@cverster Sorry I can't help you more, I don't know either. If I have another idea, I come back ;).

1 like

Please or to participate in this conversation.