forge
forge copied to clipboard
[plugin-vite] allow custom vite outDir
Pre-flight checklist
- [x] I have read the contribution documentation for this project.
- [x] I agree to follow the code of conduct that this project uses.
- [x] I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Problem description
I try to use vite plugin but I have everything configured to output to ./dist. I'm getting following error:
An unhandled rejection has occurred inside Forge:
Error: Electron Forge is configured to use the Vite plugin. The plugin expects the
"main" entry point in "package.json" to be ".vite/*" (where the plugin outputs
the generated files). Instead, it is "dist/electron/src/main.js"
I've check code and search for this issue. Why we cannot specify custom output dir? Why it is hardcoded
my vite.main.config.ts looks like this:
import { defineConfig } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy';
// https://vitejs.dev/config
export default defineConfig({
build: {
outDir: './dist/electron/src/',
},
plugins: [
viteStaticCopy({
targets:[
{
src: './projects/electron/package.json',
dest: '../'
}
]
}),
],
});
Proposed solution
Allow for custom baseDir
Alternatives considered
Remove hardcoded code
Additional information
No response
I have this issue as well.
Another webpack user had this issue and they forked: https://github.com/electron/forge/issues/2770
Subscribing. Should definitely be done for webpack as well.
And replying to the comment on the other issue...
I'm curious as to the actual use case of this
- Preferences. It's a top-level directory in my repository, which is a quite privileged spot to hold.
- IDEs usually don't hide paths starting with
., so it's something I'll always see when there are artifacts. - On top of that, directories starting with
.appear at the top in most IDEs, so it's something extra for you to skip when scanning through the file tree - I can't place the output of all build tools in the project in the same e.g.
distortargetdirectory - And finally, that's a pretty basic configuration to have.