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

Pass path to a dynamically imported file as file:// protocol URL to make it work in Windows #1048

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

psmyrek
Copy link
Contributor

@psmyrek psmyrek commented Nov 21, 2024

Suggested merge commit message (convention)

Fix (release-tools): Fixed path calculation in executeInParallel() util that prepares a path to a dynamically imported worker script. Previously, it did not work in Windows, because there is a specific requirement that absolute path must be valid file:// protocol URL. Now, the worker script is always imported using file:// protocol URL.


Additional information

Closes cksource/ckeditor5-internal#3882.

I'm not using url.pathToFileURL() to convert the path to a file:// protocol URL, because it produces unexpected results in tests where we mock process.cwd() to be Windows-style.

Example: when mocked process.cwd() is C:\Users\ckeditor, then url.pathToFileURL( 'C:/Users/ckeditor/uuid-4.mjs' ) internally tries to create an URL from file://C:%5CUsers%5Cckeditor/C:/Users/ckeditor/uuid-4.mjs and throws ERR_INVALID_URL.

Copy link
Member

@pomek pomek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to use pathToFileURL(), but I assume you tried it, and it did not work.

So, let's use the proposed solution. LGTM.

@psmyrek psmyrek merged commit 3bbf3f4 into master Nov 22, 2024
7 checks passed
@psmyrek psmyrek deleted the ci/3882 branch November 22, 2024 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants