-
Notifications
You must be signed in to change notification settings - Fork 169
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
Comments
How to parse postcss, tailwind configuration file is not determined by vite or electron-vite. For example, postcss is parsed through the |
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 / |
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 |
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) |
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? |
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. |
Are you having issues with the current implementation? because tailwind seems to work well at the root directory, i just had to update the tw config: /** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/renderer/index.html', './src/renderer/src/**/*.{js,ts,jsx,tsx}'],
theme: {
extend: {}
},
plugins: []
} |
Using this tw config results in the following warning
|
Tailwind 这个问题有办法解决吗? |
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
The text was updated successfully, but these errors were encountered: