summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2025-05-24 10:24:01 +0200
committerFabrice Bellard <fabrice@bellard.org>2025-05-24 10:24:01 +0200
commit7c487f1c6a0eec73b71cc9941f575d8788a33ead (patch)
tree1769b986e215b9aa05e5f7ce083b4c908b484e0d /examples
parent1dfaa616801a8f559eb7abf232f008a27ff5958a (diff)
downloadquickjs-7c487f1c6a0eec73b71cc9941f575d8788a33ead.tar.gz
quickjs-7c487f1c6a0eec73b71cc9941f575d8788a33ead.zip
support JSON modules in qjsc - added support of JSON5 modules (using type = "json5")
Diffstat (limited to 'examples')
-rw-r--r--examples/hello_module.js4
-rw-r--r--examples/message.json2
2 files changed, 5 insertions, 1 deletions
diff --git a/examples/hello_module.js b/examples/hello_module.js
index 463660f..5d4c78e 100644
--- a/examples/hello_module.js
+++ b/examples/hello_module.js
@@ -1,6 +1,8 @@
-/* example of JS module */
+/* example of JS and JSON modules */
import { fib } from "./fib_module.js";
+import msg from "./message.json";
console.log("Hello World");
console.log("fib(10)=", fib(10));
+console.log("msg=", msg);
diff --git a/examples/message.json b/examples/message.json
new file mode 100644
index 0000000..3b7fe48
--- /dev/null
+++ b/examples/message.json
@@ -0,0 +1,2 @@
+{ "x" : 1, "tab": [ 1, 2, 3 ] }
+