chiark / gitweb /
webstead: use .mjs for JavaSript module
authorBen Harris <bjh21@bjh21.me.uk>
Wed, 15 Oct 2025 22:33:51 +0000 (23:33 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 13 Jan 2026 21:42:18 +0000 (21:42 +0000)
This means that emcc automatically uses the correct mode, and seems
slightly more correct to me.

Makefile
webstead.xhtml

index e26e904ea3d0afa255a90661cc00e64b02cb0770..0e4bc395255c8c4f2c294deddc05addf1950c41a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ all: $(DISTFILES)
 
 .PHONY: all-web
 all-web: all sample.png extended.png icon-16.png icon-32.png icon-64.png \
-       bedstead.js
+       bedstead.mjs
 
 .PHONY: experimental
 experimental: bedstead-chiseltip.otf bedstead-plotter-thin.otf \
@@ -112,15 +112,15 @@ bedstead-complement.ps: bedstead
 bedstead-complement.pdf: bedstead-complement.ps bedstead.otf Fontmap
        ps2pdf -P $< $@
 
-EMCCFLAGS = -O2 -sEXPORT_ES6 -sEXIT_RUNTIME -sSTRICT \
+EMCCFLAGS = -O2 -sEXIT_RUNTIME -sSTRICT \
        -sINCOMING_MODULE_JS_API='["arguments","print"]'
 EMCCFLAGS += $(CWARNFLAGS)
-%.js: %.c
+%.mjs: %.c
        emcc $(EMCCFLAGS) -o $@ $<
 
 .PHONY: clean
 clean:
-       rm -f bedstead *.ttx *.otf *.bdf *.bdf.ps *.png *.pdf *.js *.wasm \
+       rm -f bedstead *.ttx *.otf *.bdf *.bdf.ps *.png *.pdf *.mjs *.wasm \
                bedstead-complement.ps
 
 .PHONY: install-user
index 0515640e9d16b201cba1037f45fe45939cea3a5d..9de99cf48c0ef266c138b2e309d062e126ebc6c1 100644 (file)
         document.querySelector('#drawing').onclick = drawing_click;
         update_glyph(true);
     }
-    import("./bedstead.js").then((module) => {
+    import("./bedstead.mjs").then((module) => {
         Bedstead = module.default;
         // This script is loaded asynchronously, so make sure the DOM is
         // loaded before touching it.