ES2025 Float16Array • I like to keep up with Web Standards ◦ Sharing new stuff in the company's frontend community petamoriken pixiv WebDev engineer in Fukuoka
* as bar from "./bar.mjs"; import baz from "./baz.mjs"; import qux from "./qux.json" with { type: "json" }; export { foo } from "./foo.mjs"; const namespace = await import("./foo.mjs");
defer import asset ref from "./foo.mjs"; console.log(ref); // AssetReference object const namespace = await import(ref); • No need to change the relative path even when the AssetReference object passes through modules
defer import asset imageRef from "./foo.png"; const img = new Image(); img.src = URL.createObjectURL(imageRef); • Allows notifying the host (runtime, bundler) about the existence of asset files statically
defer import source module from "./foo.mjs"; console.log(module); // ModuleSource object const worker = new Worker(module); • Modules for Web Workers can be statically added to ES Module Graph • Dynamic Imports work, too
source defer import defer * as namespace from "./foo.mjs"; namespace.bar; // evaluate "./foo.mjs" • Defer execution until the namespace object's getter is invoked (namespace imports only supported) • Improve initial performance by delaying evaluation
} import { foo } from Foo; • Bundlers' implementation complexity increases with ES Modules ◦ Proposal for additional syntax for bundlers • Optimizing bundled JS files is challenging for engines
gap with CommonJS using synchronous dynamic import ◦ Personally, the difference in whether cache can be purged seems like a big gap... • In a browser environment, the main thread cannot be blocked, so it might throw an exception
{ type: "bytes" }; // Uint8Array backed by an Immutable ArrayBuffer console.log(bytes); • Add bytes and text support to Synthetic Module Records • Originally proposed in whatwg/html#9444 import text from "./foo.txt" with { type: "text" }; // string (normally) interpreted as UTF-8 console.log(text);
non-browser runtimes ◦ It is likely a result of WinterTC's activities ◦ Especially for Module Sources, Deno, Node.js, and Igalia are energetically pushing it forward • Also proposed with consideration for bundlers