Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow build.manifest to be generated outside of outDir #19279

Open
4 tasks done
RazerM opened this issue Jan 23, 2025 · 0 comments
Open
4 tasks done

Allow build.manifest to be generated outside of outDir #19279

RazerM opened this issue Jan 23, 2025 · 0 comments

Comments

@RazerM
Copy link

RazerM commented Jan 23, 2025

Description

As a user of Vite's Backend Integration, I do not want the manifest file to be generated in outDir since it does not need to be public.

Vite allows the path to be customised somewhat, but trying to generate it outside of outDir is not permitted (error: "The "fileName" or "name" properties of emitted chunks and assets must be strings that are neither absolute nor relative paths").

Suggested solution

Vite could permit relative/absolute paths in the build.manifest option, which are currently prohibited. This would have to be relative to build.outDir which I don't think is ideal but it at least enables this use case.

Alternately there could be a new option like build.manifestDir or allowing build.manifest to be an object with filename so that it is backwards compatible.

Alternative

  • It was suggested in build.manifest should be able to specify the target directory #2558 to "Just move it yourself after build."

    I don't think this is particularly helpful, I am writing a backend integration that is not concerned with running Vite itself (i.e. vite build is run separately).

    Anyway, since that issue was closed the ability to customise the filename (but not the directory) was added.

  • Changing the package.json build script in every project using my backend integration to use "tsc -b && vite build && mv path/to/outDir/.vite/manifest.json somewhere/else/.vite/manifest.json"

    This means needless duplication of the outDir from vite.config.ts.

  • Wrapping Vite using the JavaScript

    For example, Remix moves the manifest file in this way since it's already running Vite for you. While powerful, this seems like too much effort to move a generated file to a non-public path. My backend integration is not in JS.

Additional context

No response

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant