Skip to content

Commit

Permalink
chore: add invariant instead of using !
Browse files Browse the repository at this point in the history
Signed-off-by: Logan McAnsh <logan@mcan.sh>
  • Loading branch information
mcansh committed Dec 8, 2022
1 parent 3d5527a commit 13c79c3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/remix-dev/compiler/compileBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { emptyModulesPlugin } from "./plugins/emptyModulesPlugin";
import { mdxPlugin } from "./plugins/mdx";
import { urlImportsPlugin } from "./plugins/urlImportsPlugin";
import { writeFileSafe } from "./utils/fs";
import invariant from "../invariant";

export type BrowserCompiler = {
// produce ./public/build/
Expand Down Expand Up @@ -70,7 +71,7 @@ const createEsbuildConfig = (
entryPoints[id] = config.routes[id].file + "?browser";
}

let plugins = [
let plugins: esbuild.Plugin[] = [
deprecatedRemixPackagePlugin(options.onWarning),
cssFilePlugin(options),
urlImportsPlugin(),
Expand Down Expand Up @@ -128,9 +129,12 @@ export const createBrowserCompiler = (
metafile: true,
incremental: true,
});
metafile = compiler.metafile!;
invariant(compiler.metafile, "Expected metafile to be defined");
metafile = compiler.metafile;
} else {
metafile = (await compiler.rebuild()).metafile!;
let rebuild = await compiler.rebuild();
invariant(rebuild.metafile, "Expected metafile to be defined");
metafile = rebuild.metafile;
}
let manifest = await createAssetsManifest(remixConfig, metafile);
manifestChannel.write(manifest);
Expand Down

0 comments on commit 13c79c3

Please sign in to comment.