mirror of
https://github.com/hanzoai/esbuild.git
synced 2026-10-30 14:46:14 +00:00
53 lines
1.4 KiB
Plaintext
53 lines
1.4 KiB
Plaintext
TestImportDeferExternalESM
|
|
---------- /out.js ----------
|
|
// entry.js
|
|
import defer * as foo0 from "./foo.json";
|
|
import defer * as foo1 from "./foo.json" with { type: "json" };
|
|
|
|
// import.defer("./**/*.json") in entry.js
|
|
var globImport_json = __glob({
|
|
"./foo.json": () => import.defer("./foo.json")
|
|
});
|
|
|
|
// import.defer("./**/*.json") in entry.js
|
|
var globImport_json2 = __glob({
|
|
"./foo.json": () => import.defer("./foo.json", { with: { type: "json" } })
|
|
});
|
|
|
|
// entry.js
|
|
console.log(
|
|
foo0,
|
|
foo1,
|
|
import.defer("./foo.json"),
|
|
import.defer("./foo.json", { with: { type: "json" } }),
|
|
globImport_json(`./${foo}.json`),
|
|
globImport_json2(`./${foo}.json`)
|
|
);
|
|
|
|
================================================================================
|
|
TestImportSourceExternalESM
|
|
---------- /out.js ----------
|
|
// entry.js
|
|
import source foo0 from "./foo.json";
|
|
import source foo1 from "./foo.json" with { type: "json" };
|
|
|
|
// import.source("./**/*.json") in entry.js
|
|
var globImport_json = __glob({
|
|
"./foo.json": () => import.source("./foo.json")
|
|
});
|
|
|
|
// import.source("./**/*.json") in entry.js
|
|
var globImport_json2 = __glob({
|
|
"./foo.json": () => import.source("./foo.json", { with: { type: "json" } })
|
|
});
|
|
|
|
// entry.js
|
|
console.log(
|
|
foo0,
|
|
foo1,
|
|
import.source("./foo.json"),
|
|
import.source("./foo.json", { with: { type: "json" } }),
|
|
globImport_json(`./${foo}.json`),
|
|
globImport_json2(`./${foo}.json`)
|
|
);
|