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

Possibility to change current working directory #411

Open
4 tasks done
Kinqdos opened this issue Feb 15, 2024 · 6 comments
Open
4 tasks done

Possibility to change current working directory #411

Kinqdos opened this issue Feb 15, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@Kinqdos
Copy link

Kinqdos commented Feb 15, 2024

Clear and concise description of the problem

It would be awesome I you can change the current working directory especially for the renderer. I you use libraries like postcss or tailwind you have to place those config at the root of the project rather than in src/renderer. Another example would be tanstack router. It searches for routes in src/routes and not in src/renderer/src/routes. To get around you have to place a config file at the route of the project to tell the router where to look for routes.

Suggested solution

A fix can be provided by executing the renderers vite instance from the src/renderer instead of executing it from the project root and tell vite only to find the files under src/renderer.

Alternative

An alternative solution can be provided by defining the location where vite gets executed from.

Additional context

No response

Validations

@Kinqdos Kinqdos added the enhancement New feature or request label Feb 15, 2024
@alex8088
Copy link
Owner

How to parse postcss, tailwind configuration file is not determined by vite or electron-vite. For example, postcss is parsed through the postcss-load-config plugin, which can be configured through the css.postcss option in vite. The tanstack router can be customized through @tanstack/router-vite-plugin but not vite or electron-vite.

@Kinqdos
Copy link
Author

Kinqdos commented Feb 19, 2024

How to parse postcss, tailwind configuration file is not determined by vite or electron-vite. For example, postcss is parsed through the postcss-load-config plugin, which can be configured through the css.postcss option in vite. The tanstack router can be customized through @tanstack/router-vite-plugin but not vite or electron-vite.

The location where those libraries are searching for their config files is dependening from where you start vite. You can try it yourself if you run vite from the project root tailwind (for example) is looking for the tailwind.config.ts under / but if you first change directory to src/renderer and then run vite, tailwind is looking for the config under src/renderer. And this is what Im looking for. I want to place all config files wich are only related to the renderer (e.g. tailwind, postcss, tanstack router, ...) under src/renderer and not under /

@alex8088
Copy link
Owner

This seems unfeasible, build tools usually use the root directory as the working directory. Changing the working directory during the build process is obviously difficult and unpredictable. For example, Vite also can not read its postcss configuration in the specified directory unless postcss-load-config plugin support.

@Kinqdos
Copy link
Author

Kinqdos commented Feb 23, 2024

This is not what I meant, isn't it possible to just start vite renderer directory? For example in my web projects, I have an app/ directory and ui/ directory. And the package.json script I used to start vite was just "vite dev". But I changed it to "cd ui/ && vite dev" this way I can place all my config files that are just related to the frontend (tailwind, postcss, router, etc...) under ui/ and I dont have to place them under the project root directory (next to the package.json)

@Kinqdos
Copy link
Author

Kinqdos commented Mar 1, 2024

So no chance to achieve what I want? Everyone has to mix config files from the renderer and the main process at the project root?

@alex8088
Copy link
Owner

alex8088 commented Mar 1, 2024

Your idea is not very feasible, but the tanstack router you use can be customized via @tanstack/router-vite-plugin and postcss requires it to be in the root directory.

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

No branches or pull requests

2 participants