nbb.core/*file* doesn't survive bundle

Open
#377 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
clojure, node.js
Domain
build-system, cli

Research direction

Reproduce the behavior with the provided printme.cljs example and the nbb bundle commands, then trace how nbb.core/file is handled during bundling. Done means the generated printme.mjs reports its own script location when run with Node, rather than nil.

Written by the indexing model from the issue text.

Description

I am not sure if this is a bug or a feature request.

nbb v1.3.196
Ubuntu 22.04
Node v20.17.0

If you run nbb bundle printme.cljs -o printme.mjs and run the resulting script with node printme.mjs, any reference to nbb.core/*file* doesn't survive.

(ns printme
  (:require [nbb.core :refer [*file*]]))
(print *file*)
npx nbb bundle printme.cljs -o printme.mjs
npx nbb printme.cljs # outputs the path to the script
node printme.mjs # outputs nil

I expected *file* to be the .mjs script's location.

I can hack around this for now of course but I thought I'd file it just in case.

Dominant language
Clojure
Stars
972
Forks
56
Avg merge
1m
Merged PRs (30d)
6

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from babashka/nbb

All issues in babashka/nbb

Similar issues

More Clojure issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.