Import Attributes

TL;DR

import文のMIMEタイプ指定がサポートされた。

Usage

import json from "./foo.json" with { type: "json" };
import styles from "./styles.css" with { type: "css" };

属性を拡張してメタデータを渡せるようになったと記載がある。 用途不明。

import value from "module" with { attr: { key1: "value1" } };

ダイナミックインポートの場合は以下のように記述する。

import("foo.json", { with: { type: "json" } });

最終更新