【2024/08/20】 WasmCG で進行している ES Module Integration についての記述を追加 Import Attributes の assert キーワードが正式に仕様から取り除かれたのに追随 【2024/05/26】 せっかくなので好きなTC39 Proposals発表ドラゴンをファーストビューに追加 モジュールインスタンスフェーズがなくなり、ソースフェーズと同じレイヤーへと変更されたのに追随 Import Attributes で assert キーワードの廃止が検討されていることを追記 同期モジュールアサートがディレクティブを使うよう変更されたのに追随 Compartments のインターフェースが変更されたのに追随し、独立の章としてまとめるよう変更 好きなTC39 Proposals発表ドラゴン(ニコニコ動画、YouTube) Module Harmo
皆さんこんにちは。早速ですが、TypeScriptのmoduleオプションはご存じでしょうか。moduleオプションは、例えば次のような値をサポートしています。 commonjs umd es2015 esnext node16 nodenext 皆さんは、moduleオプションが何を設定するオプションなのか一言で説明できますか? 実は、TypeScriptの熟練者であってもmoduleオプションを一言で説明することは難しいはずです。なぜなら、そもそもこのmoduleオプションが複数の異なる意味で使われており、もはや一言で説明できるようなものではなくなってしまったからです。 この記事では、TypeScriptのメンテナーが書いた次のGitHub issueをベースに、moduleオプションを取り巻く状況を説明します。 moduleオプションの意味とは 昔はmoduleオプションの意味は明確
大きめのテーマです。もしかしたら「うちでは書いた JS をそのまま配信してるぜ〜」って人もいるかもしれないでが。 最近の Web フロントエンド開発では、書いた JavaScript をそのまま動かさないことが多い 最近のフロントエンド開発ではエンジニアが書いた JavaScript をそのままブラウザで動かすことはほとんどないかもしれません。 例として最近流行のフレームワークを考えてみましょう。Next.js や Remix、Nuxt.js など、いずれも内部的にトランスパイラやモジュールバンドラを使い、エンジニアが書いた JavaScript を別の形へと変換してからユーザーのブラウザで動かすような仕組みになっています。 一昔前だと Next.js のようなフレームワークが今ほど発展していなかったこともあり、webpack や Babel を直接使っていたと思いますが、それも同じです。
Interop between ECMAScript modules, aka ES modules, aka ESM, aka JavaScript modules, and CommonJS, aka CJS, modules is a complicated and confusing matter most JavaScript developers no doubt don't want to have to think about. There are more mission-critical things on which to spend time and brain cycles, namely application logic. Still, it's consequential in the modern JS ecosystem for two reasons:
At the end of April, Node.js 10 goes out of LTS, which means I can target Node.js 12 in my packages. Node.js 12 has full ESM support! Required reading: https://nodejs.org/api/esm.html I plan to migrate most of my (1K+) packages to ESM within 2021. At the start of April, I will begin with some less popular packages, just to test the waters. I will use "type": "module" in package.json and not .mjs.
ESM-CJS interop test Test Cases Results Node.js Babel Webpack Rollup.js Parcel esbuild Results by test case Results by syntax import x and similar import { named } and similar import { __esModule } and similar import * and similar import() and similar require().default and similar require().named and similar require().__esModule and similar require() and similar Direct differences Webpack <-> Node
2024 2024-12-31: 2024年の振り返り 2024-12-10: WebKit(JavaScriptCore)に100個のPull Requestがマージされた 2024-11-24: [JSConf JP 2024 感想] Unicode 15.1でU+200CとU+2004がID_Continueに入ったことによってECMAScriptがちょっと更新されていたことに気がついた 2024-10-29: 標準偏差さんとsksatのツイートから学ぶABI(Application Binary Interface) 2024-10-22: VueFes Japan 2024の「次世代フロントエンドクロストーク」の感想ともっと聞きたかったこと 2024-10-16: Intl.DurationFormatの最大値を規定する仕様について 2024-08-19: WebKitのコミッタ
import { init, parse } from 'es-module-lexer'; (async () => { await init; const source = ` import { name } from 'mod\\u1011'; import json from './json.json' assert { type: 'json' } export var p = 5; export function q () { }; export { x as 'external name' } from 'external'; // Comments provided to demonstrate edge cases import /*comment!*/ ( 'asdf', { assert: { type: 'json' }}); import /*comment!*/
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く