Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding :final-output-to to :launch-js args map and command vector replacement keywords. #307

Open
prook opened this issue Nov 18, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@prook
Copy link

prook commented Nov 18, 2021

I'm trying to set up cljs testing in node.js using jsdom following this blog. My goal is to add bundler (webpack, but this probably applies to all bundlers and processors) on top of that.

This is my dev-test.cljs.edn:

^{:auto-bundle         :webpack
  :watch-dirs          ["src/cljs" "src/cljc" "test/cljs" "test/cljc"]
  :css-dirs            ["target/public/css"]
  :target-dir          "target"
  :ring-server-options {:port 9501}
  :launch-js           ["node" "test/cljs/test_environment.js"
                        <<script-to-run>> :open-url]}
{:main   myapp.test-runner-headless
 :target :nodejs}

When specifying :launch-js, both the command vector and clj function get access to :open-url and :output-to. However when using a bundler, I need to point at the bundle file in <<script-to-run>>, i.e., target/.../main_bundle.js, not :output-to, which points at target/.../main.js (and blows up with "SyntaxError: Cannot use import statement outside a module" when called directly).

I can make this work by using the actual path "target/public/cljs-out/dev-test/main_bundle.js" in place of <<script-to-run>>, but it feels like a bodge, and does not seem great from maintainability point of view as well. I'd be much happier if I could just use :final-output-to as it is possible in :bundle-cmd.

@bhauman bhauman added the enhancement New feature or request label Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants