remix icon indicating copy to clipboard operation
remix copied to clipboard

Invalid manifest reports `{client,server}/.vite/manifest.json`

Open moltar opened this issue 1 year ago • 7 comments

Reproduction

When building with vite, a report is generated:

remix vite:build
vite v5.2.6 building for production...
✓ 78 modules transformed.
lib/client/.vite/manifest.json                0.87 kB │ gzip:  0.31 kB
lib/client/assets/root-DRAKfHZW.js            1.40 kB │ gzip:  0.81 kB
lib/client/assets/entry.client-d9pQ8Er6.js   14.02 kB │ gzip:  4.98 kB
lib/client/assets/components-RnERyssy.js    220.88 kB │ gzip: 71.26 kB
✓ built in 477ms
vite v5.2.6 building SSR bundle for production...
✓ 4 modules transformed.
lib/server/.vite/manifest.json  0.15 kB
lib/server/index.js             5.35 kB
✓ built in 14ms

Which lists lib/client/.vite/manifest.json and lib/server/.vite/manifest.json.

Yet, when I check on disk, these files are not actually there:

❯ tree -a lib
lib
├── .remix
│   └── manifest.json
├── client
│   └── assets
│       ├── components-RnERyssy.js
│       ├── entry.client-d9pQ8Er6.js
│       ├── manifest-6c588b00.js
│       └── root-DRAKfHZW.js
└── server
    └── index.js
❯ ll lib/client/.vite/manifest.json
ls: lib/client/.vite/manifest.json: No such file or directory

System Info

System:
    Memory: 106.17 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 123.0.6312.86
    Safari: 17.2.1
  npmPackages:
    @remix-run/dev: ^2.8.1 => 2.8.1 
    @remix-run/node: ^2.8.1 => 2.8.1 
    @remix-run/react: ^2.8.1 => 2.8.1 
    @remix-run/serve: ^2.8.1 => 2.8.1 
    @remix-run/server-runtime: ^2.8.1 => 2.8.1 
    vite: ^5.2.6 => 5.2.6

Used Package Manager

pnpm

Expected Behavior

Either files not to be there, or do not report them.

Actual Behavior

Files being reported.

moltar avatar Mar 26 '24 20:03 moltar

Apparently, Vite generates the manifest files, but Remix only keeps the files if Remix config manifest=true.

export default defineConfig({
  plugins: [
    remix({
      manifest: true,
    }),
    tsconfigPaths(),
  ],
});

https://github.com/remix-run/remix/blob/878440781095205487bc735b535ac8bc78740491/packages/remix-dev/vite/build.ts#L302-L307

https://remix.run/docs/en/main/file-conventions/vite-config#manifest

kiliman avatar Mar 26 '24 21:03 kiliman

I did have manifest true set by the way

moltar avatar Mar 26 '24 22:03 moltar

Hmm... then I'm not sure why it's not working for you then. Can you post your vite.config.ts file?

image

kiliman avatar Mar 26 '24 22:03 kiliman

It's working in a way that it produces .remix/Manifest.json

But the issue I reported is that the build log reports alternative file manifests.

moltar avatar Mar 26 '24 22:03 moltar

I think I understand. The manifest.json file is the same for both client and server. The build/client|server/.vite/manifest.json is generated as a byproduct of the build process.

If you have config.manifest=true, then Remix will move the file to the build/.remix folder and removes it from the .vite folders.

I believe the output is from the Vite compiler. It does output the files, it's just that Remix will then move/delete the manifest based on the config option.

kiliman avatar Mar 26 '24 22:03 kiliman

Not sure how easy it would be to modify the manifest.json line.

Another option is to simply output Moving manifest.json to ./remix folder, or Removing manifest.json as needed.

kiliman avatar Mar 26 '24 22:03 kiliman

I believe the output is from the Vite compiler. It does output the files, it's just that Remix will then move/delete the manifest based on the config option.

That makes sense.

I just wanted to point out that the log might be misleading.

Otherwise, there's no issue.

Feel free to close if this is non-actionable.

Thanks for your time! :)

moltar avatar Mar 26 '24 23:03 moltar