11.2.2 Requiring JS

Open
#8 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
documentation

Research direction

Start at documentation section 11.2.2, “Requiring JS,” and read the explanation of relative requires and the IMPORTANT note. Clarify the note about classpath lookup versus physical file location, preserving the distinction from Node.js; the section should be understandable without asking what the comment means.

Written by the indexing model from the issue text.

Description

Relative requires are resolved by first looking at the current namespace and then resolving a relative path from that name. In the above example we are in demo/app.cljs to the ./bar require resolve to demo/bar.js, so it is identical to (:require ["/demo/bar"]).

IMPORTANT | The files must not be physically located in the same directory. The lookup for the file appears on the classpath instead. This is unlike node which expects relative requires to always resolve to physical files.

Thomas, I find this IMPORTANT comment obscure.

Dominant language
Makefile
Stars
31
Forks
75
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

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 shadow-cljs/shadow-cljs.github.io

All issues in shadow-cljs/shadow-cljs.github.io

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.