Repository navigation
Fix/windows migration - #113
Conversation
|
@nischaldoescode hello. Did you try the other way around ? Here is an example without regex ’’’ const __filename = fileURLToPath(import.meta.url); const filePath = path.join(__dirname, 'data', 'config.json'); The file path should be cross platform |
|
@HendrixString hi, Well I didn't test it without regex I beleive it will be best if we stick with this. It should work cross platform did you test in Linux ?. Do you specifically want it to be without regex, if so I am all in for that if you really want it. Then we can close this pr as accepted. I am bit busy nowadays will be back at razorpay as soon as I have some time. |
|
@nischaldoescode regex is less predictable, i propose using something more predictable. dont worry about tests, i have a github action runner that runs the tests on a cloud machine. Before pushing the patch, make sure your local Windows machine migration works
Thanks bro |
|
@HendrixString I have changed the regex with the node's native work around can you check and possibly merge it ?. I would also like to request to mention about the way to use tests in the readme, We can have contributing readme then mention the fact that check how i have used it in the razorpay tests ?. I hope you got it ... Regards. |
|
@nischaldoescode tests have passed, I merged |
|
Thankyou Tomer Sir.. Hope it added some value to this project. |
Fix: #112
What this PR does
This PR fixes migration loading on Windows by ensuring file paths are converted to valid
file://URLs using Node’s built-in utilities.Key points
FixedFileMigrationProviderthat:path.resolvepathToFileURLmigrate.jsto use this provider.Why this is needed
When using dynamic import() with file paths, Node expects properly formatted file:// URLs.
The default
FileMigrationProviderworks on Unix-type systems, but Windows produces malformed URLs when convertingC:\path\...intofile://URLs. This results in:ERR_UNSUPPORTED_ESM_URL_SCHEMEThe custom provider ensures consistent behavior on all platforms.
Tested on