windowjs / windowjs

Window.js is an open-source Javascript runtime for desktop graphics programming.

Home Page:https://windowjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add feature import export

hanako-eo opened this issue · comments

commented

Add the possibility of import export js file

export function hello(){
    console.log("hello world")
}
import {hello} from "./imported.js"

hello()

This is already supported and should work. Did you get any problems trying to run that code?

commented

Oh ok, my problem it's because nodejs can get the content with only "./file", the .js is optional ^^' and windowjs does not do so

Thanks for confirming.

The error message could give a hint: if the file can't be read and the filename doesn't end in .js nor in .mjs then mention that the extension is required.

This is a good first bug; the lines to be fixed are here:

if (!ReadFile(path, &content, &error)) {