You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PS C:\Users\Ingwie Phoenix\work\v-test> v -skip-unused -backend js -prod .\js_hello_world.v -o hello.js
PS C:\Users\Ingwie Phoenix\work\v-test> esbuild --minify --platform=browser --bundle hello.js --outfile=hello.min.js
✘ [ERROR] Cannot assign to "len" because it is a constant
hello.js:3010:2:
3010 │ len = arr.length
╵ ~~~
The symbol "len" was declared a constant here:
hello.js:3009:8:
3009 │ const len = new int(new int(0));
╵ ~~~
✘ [ERROR] Could not resolve "os"
hello.js:7:20:
7 │ const $os = require("os");
╵ ~~~~
The package "os" wasn't found on the file system but is built into node. Are you trying to bundle
for node? You can use "--platform=node" to do that, which will remove this error.
2 errors
Versions:
> v version
V 0.4.9 e9c2314
> esbuild --version
0.25.0
Wanted to try and use V to write my frontend instead of TypeScript and just threw some of my favorite tools at the output to see what would happen.
Reproduction Steps
Take examples/js_hello_world.v verbatim.
Compile using the js (also same for js_browser) backend to hello.js
Throw esbuild at it.
Commands are above in the snippet.
Expected Behavior
The browser has neither require() nor an os module. It just shouldn't be emitted, or a polyfill included.
Current Behavior
A call to require() is made although there shouldn't be one.
Also, as an aside, it attempts to modify a const, which it shouldn't. Make it let or var instead (probably the former)
Possible Solution
There should be some polyfills that you could use if you needed os support. I haven't looked at what exactly the issue is yet, though, nor which APIs are needed.
Describe the bug
Hello!
Basically:
Versions:
Wanted to try and use V to write my frontend instead of TypeScript and just threw some of my favorite tools at the output to see what would happen.
Reproduction Steps
examples/js_hello_world.vverbatim.js(also same forjs_browser) backend tohello.jsesbuildat it.Commands are above in the snippet.
Expected Behavior
The browser has neither
require()nor anosmodule. It just shouldn't be emitted, or a polyfill included.Current Behavior
A call to
require()is made although there shouldn't be one.Also, as an aside, it attempts to modify a
const, which it shouldn't. Make itletorvarinstead (probably the former)Possible Solution
There should be some polyfills that you could use if you needed
ossupport. I haven't looked at what exactly the issue is yet, though, nor which APIs are needed.Additional Information/Context
Got none; just tried stuff out...
V version
V 0.4.9 e9c2314
Environment details (OS name and version, etc.)
Windows 10:
Microsoft Windows [Version 10.0.19045.5440]Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.