Skip to content

Commit

Permalink
🐛 Fixed a bug where custom entry points would fail to bundle.
Browse files Browse the repository at this point in the history
  • Loading branch information
hayleigh-dot-dev committed Nov 28, 2024
1 parent dbd78e4 commit 3d739fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion priv/template/entry-with-main.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { main } from "../dev/javascript/{app_name}/{app_name}.mjs";
import { main } from "../dev/javascript/{app_name}/{entry_module}.mjs";

main();
6 changes: 5 additions & 1 deletion src/lustre_dev_tools/cli/build.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ pub fn do_app(

use <- cli.success("Project compiled successfully")
use <- cli.log("Creating the bundle entry file")
use app_name <- cli.do(cli.get_name())
let root = project.root()
let tempdir = filepath.join(root, "build/.lustre")
let default_outdir = filepath.join(root, "priv/static")
Expand All @@ -94,7 +95,10 @@ pub fn do_app(
let _ = simplifile.create_directory_all(tempdir)
let _ = simplifile.create_directory_all(outdir)
use template <- cli.template("entry-with-main.mjs")
let entry = string.replace(template, "{app_name}", entry_module)
let entry =
template
|> string.replace("{app_name}", app_name)
|> string.replace("{entry_module}", entry_module)

let entryfile = filepath.join(tempdir, "entry.mjs")
use ext <- cli.do(
Expand Down

0 comments on commit 3d739fa

Please sign in to comment.