Skip to content

v.pref: prevent overriding backend (fix #21758)#24526

Merged
spytheman merged 2 commits into
vlang:masterfrom
gchumillas:fix__hello_world_does_not_work_in_browser_with_the_js_browser_backend
May 20, 2025
Merged

v.pref: prevent overriding backend (fix #21758)#24526
spytheman merged 2 commits into
vlang:masterfrom
gchumillas:fix__hello_world_does_not_work_in_browser_with_the_js_browser_backend

Conversation

@gchumillas

Copy link
Copy Markdown
Contributor

Fixes #21758

Related to PR #23797

@huly-for-github

Copy link
Copy Markdown

Connected to Huly®: V_0.6-22894

@gchumillas gchumillas changed the title fix: prevent overriding backend (fix #21758) v.pref: prevent overriding backend (fix #21758) May 19, 2025
@JalonSolov

Copy link
Copy Markdown
Collaborator

Is this really a good thing? There are multiple JS types for a reason... the first being that you may want to run the code in a browser, not node. This looks like changes things to only output for node.

@gchumillas

gchumillas commented May 19, 2025

Copy link
Copy Markdown
Contributor Author

Is this really a good thing? There are multiple JS types for a reason... the first being that you may want to run the code in a browser, not node. This looks like changes things to only output for node.

This PR only prevents the manually entered -backend flag from being overridden. For example:

// -backend is "js" by default
v main.v -o main.js

// don't override -backend, as it has been manually entered
v -backend js_browser main.v -o main.js

The default value was established here (line 1054):
https://github.com/vlang/v/pull/23797/files#diff-e706d00d8dda53e89b46391f9de496dc45f5efc1fb9776c3d230fc708aba8aa3R1054

@JalonSolov

Copy link
Copy Markdown
Collaborator

Ah, so opposite of what I thought. Carry on. :-)

Comment thread vlib/v/pref/pref.v Outdated
Co-authored-by: Delyan Angelov <delian66@gmail.com>
@spytheman spytheman merged commit 6be298d into vlang:master May 20, 2025
67 of 68 checks passed
@spytheman

Copy link
Copy Markdown
Contributor

Excellent work.

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.

"Hello world" does not work in browser with the "js_browser" backend

3 participants