Skip to content

Commit

Permalink
refactor(runtime): use dynamic import for emit module to improve cli …
Browse files Browse the repository at this point in the history
…performance (#70)
  • Loading branch information
c4spar authored Jul 10, 2022
1 parent a05e1ab commit fa9e52f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
11 changes: 4 additions & 7 deletions src/cli/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
Command,
copy,
denoBundle,
DenoBundleOptions,
ValidationError,
} from "./deps.ts";
import { Command, copy, DenoBundleOptions, ValidationError } from "./deps.ts";
import { error } from "../_utils.ts";
import { path } from "../runtime/mod.ts";
import { bootstrapModule } from "./lib/bootstrap.ts";
Expand Down Expand Up @@ -90,6 +84,9 @@ async function bundleFile(
if (options.check) {
await check(file);
}
const { bundle: denoBundle } = await import(
"https://deno.land/x/[email protected]/mod.ts"
);
const { code } = await denoBundle(file, {
type: "module",
...options,
Expand Down
5 changes: 1 addition & 4 deletions src/cli/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,4 @@ export {
ValidationError,
} from "https://deno.land/x/[email protected]/command/_errors.ts";
export { tokens } from "https://deno.land/x/[email protected]/mod.ts";
export {
bundle as denoBundle,
type BundleOptions as DenoBundleOptions,
} from "https://deno.land/x/[email protected]/mod.ts";
export { type BundleOptions as DenoBundleOptions } from "https://deno.land/x/[email protected]/mod.ts";

0 comments on commit fa9e52f

Please sign in to comment.