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

Base variable gets ignored #466

Open
4 tasks done
FynniX opened this issue Apr 3, 2024 · 7 comments · May be fixed by #467
Open
4 tasks done

Base variable gets ignored #466

FynniX opened this issue Apr 3, 2024 · 7 comments · May be fixed by #467

Comments

@FynniX
Copy link

FynniX commented Apr 3, 2024

Describe the bug

The base variable inside electron.vite.config.ts gets ignored.
The build output always shows a prefix of ./ in front of assets links.

Electron-Vite Version

2.0.0

Electron Version

28.2.0

Vite Version

5.0.12

Validations

@FynniX FynniX linked a pull request Apr 3, 2024 that will close this issue
7 tasks
@alex8088
Copy link
Owner

alex8088 commented Apr 4, 2024

The base option should not be set in Electron. I think your problem is not with this option, but with your project structure and configuration.

@alex8088
Copy link
Owner

alex8088 commented Apr 4, 2024

Maybe your problem is static public assets handling.

@FynniX
Copy link
Author

FynniX commented Apr 4, 2024

I see the point you are making here but there are specific application requirements where you would need a http server, so why would you restrict it to not setting the base in that case? The base is still ./ by default in my PR. It would just allow for more range of freedom for the usage of electron-vite.

@TodayCG
Copy link

TodayCG commented Apr 8, 2024

I also have this problem. I need to output both web and exe at the same time, so that 'base' can be used normally in the web. Now, both web and exe can run normally, but I need to configure base separately. How should I solve this problem?

@alex8088
Copy link
Owner

alex8088 commented Apr 8, 2024

base option not work in Electron. The recommended way is to add a vite config with the specified different output directories and use vite to bundle your renderer.

@FynniX
Copy link
Author

FynniX commented Apr 8, 2024

I also have this problem. I need to output both web and exe at the same time, so that 'base' can be used normally in the web. Now, both web and exe can run normally, but I need to configure base separately. How should I solve this problem?

I published my fork under https://www.npmjs.com/package/@fynnix/electron-vite, where the base parameter can be changed.
I have the same reason as you, where I output something via web and a electron window.

@FynniX
Copy link
Author

FynniX commented Apr 8, 2024

base option not work in Electron. The recommended way is to add a vite config with the specified different output directories and use vite to bundle your renderer.

Your suggestion should work as long as you dont use something like preact prerendering.

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

Successfully merging a pull request may close this issue.

3 participants