-
-
Notifications
You must be signed in to change notification settings - Fork 501
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
Fixed root path to line up with router-generator #1259
Conversation
I am not sure |
Yeah I see your point. Its the same behavior as the router cli. It searches for routes (and the config file) from the directory you started the cli / vite. This is already the behavior of the route generator. The problem is that the plugin wich handles the hmr updates always takes the vite root directory as "starting" point. (vite root is the directory with the index.html) Another solution would be passing the vite root to the route generator instead of passing a relative directory. But therefore you also have to edit the router generator. |
"edit the router generator " in which way? |
Because the generator function exported by the router-generator only takes the userConfig as argument. So you have to add the root directory as argument |
i see no problem with this additional change, can you update the PR? |
Yes I can do! My concern is, that other packages wich also depend on the export async function getConfig(
inlineConfig: Partial<Config> = {},
configDirectory?: string,
): Promise<Config> {
if (configDirectory === undefined) {
configDirectory = process.cwd()
}
... |
Any thoughts? Or should I start update the pr? |
can't you add the root directory as optional argument, if it is not set, fall back to |
Just thinking if it is good to change the behavior here. The router-generator relies on cwd why can't the vite plugin? With passing the root to the generator we are introducing a different behavior between the vite plugin and the cli. The vite plugin is looking for config in the vite route directory, but if you switch over to using the cli nothing will work. The cli is looking for the config in the cwd and not in the vite root. So you have to move your config from the vite root to the cwd and update the paths in the config. Is this a better solution than keeping the cwd solution in the vite-plugin? |
ok, let's merge this, and wait for complaints :) |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit dd1faa9. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
Fixes issue #1240