-
-
Notifications
You must be signed in to change notification settings - Fork 297
Reverted change in the react-router plugin on windows #1130
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Could we then also re-enable the Windows test?
@@ -47,7 +48,7 @@ const resolveConfig: ResolveConfig<PluginConfig> = async (localConfig, options) | |||
// See: | |||
// - https://reactrouter.com/how-to/file-route-conventions#optional-segments | |||
// - https://www.npmjs.com/package/fast-glob#advanced-syntax | |||
.map(route => route.replace(/[$^*+?()\[\]]/g, '\\$&')); | |||
.map(route => os.platform() === "win32" ? route : route.replace(/[$^*+?()\[\]]/g, '\\$&')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.map(route => os.platform() === "win32" ? route : route.replace(/[$^*+?()\[\]]/g, '\\$&')); | |
.map(route => isWindows ? route : route.replace(/[$^*+?()\[\]]/g, '\\$&')); |
@@ -5,6 +5,7 @@ import { join } from '../../util/path.js'; | |||
import { hasDependency, load } from '../../util/plugin.js'; | |||
import vite from '../vite/index.js'; | |||
import type { PluginConfig, RouteConfigEntry } from './types.js'; | |||
import os from 'node:os'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import os from 'node:os'; | |
import os from 'node:os'; | |
const isWindows = os.platform() === 'win32'; |
commit: |
Co-authored-by: Lars Kappert <[email protected]>
Thanks, Alem! 🙏 |
🚀 This pull request is included in v5.61.0. See Release 5.61.0 for release notes. Using Knip in a commercial project? Please consider becoming a sponsor. |
Due to this bug fix: #988 the entries on Windows are completely broken due to a transform happening midway between the plugin and the final resolver which turns the escaped \ \ into /.
I couldn't pinpoint the exact cause, and this fix mostly covers the issues on Windows, the only thing that won't work is the ( ) escape.