Skip to content

Commit dabc854

Browse files
committed
fix npm-module docs
1 parent 88d798e commit dabc854

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

docs/UsersGuide.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5237,7 +5237,7 @@ <h2 id="target-npm-module"><a class="anchor" href="#target-npm-module"></a><a cl
52375237
<code>:output-dir</code>
52385238
</td>
52395239
<td class="hdlist2">
5240-
<p>The path for the output files are written to, defaults to <code>node_modules/shadow-cljs</code>.</p>
5240+
<p>(required) The path for the output files are written to</p>
52415241
</td>
52425242
</tr>
52435243
<tr>
@@ -5265,11 +5265,12 @@ <h2 id="target-npm-module"><a class="anchor" href="#target-npm-module"></a><a cl
52655265
<span class="symbol">:builds</span>
52665266
{<span class="symbol">:code</span>
52675267
{<span class="symbol">:target</span> <span class="symbol">:npm-module</span>
5268+
<span class="symbol">:output-dir</span> <span class="string"><span class="delimiter">&quot;</span><span class="content">out</span><span class="delimiter">&quot;</span></span>
52685269
<span class="symbol">:entries</span> [demo.foo]}}}</code></pre>
52695270
</div>
52705271
</div>
52715272
<div class="paragraph">
5272-
<p>If you use the default <code>:output-dir</code> of <code>"node_modules/shadow-cljs"</code> you can access the declared namespaces by using <code>require("shadow-cljs/demo.foo")</code> in JS. When using something not in <code>node_modules</code> you must include them using a relative path. With <code>:output-dir "out"</code> that would be <code>require("./out/demo.foo")</code> from your project root.</p>
5273+
<p>With a JS file sitting in your project root, you may <code>require("./out/demo.foo")</code> to load the CLJS namespace and access it from JS. The JS requires must be the relative path from the JS file location to the CLJS output.</p>
52735274
</div>
52745275
<div class="paragraph">
52755276
<p>If you plan to distribute code on NPM, then you may want to use the <a href="#target-node-library"><code>:node-library</code> target</a> instead since it allows for a finer level of control over exports and optimization.</p>

docs/target-npm-module.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ There is an additional target that is intended to integrate CLJS into an existin
22
create-react-app, ...) with little configuration.
33

44
[horizontal]
5-
`:output-dir`:: The path for the output files are written to, defaults to `node_modules/shadow-cljs`.
5+
`:output-dir`:: (required) The path for the output files are written to
66
`:entries`:: (required) A vector of namespace symbols that should be compiled
77
`:ns-regexp`:: (optional) A regular expression matching namespaces against project files. This only scans files, and will not scan jars.
88

@@ -12,10 +12,11 @@ create-react-app, ...) with little configuration.
1212
:builds
1313
{:code
1414
{:target :npm-module
15+
:output-dir "out"
1516
:entries [demo.foo]}}}
1617
```
1718

18-
If you use the default `:output-dir` of `"node_modules/shadow-cljs"` you can access the declared namespaces by using `require("shadow-cljs/demo.foo")` in JS. When using something not in `node_modules` you must include them using a relative path. With `:output-dir "out"` that would be `require("./out/demo.foo")` from your project root.
19+
With a JS file sitting in your project root, you may `require("./out/demo.foo")` to load the CLJS namespace and access it from JS. The JS requires must be the relative path from the JS file location to the CLJS output.
1920

2021
If you plan to distribute code on NPM, then you may want to use the <<target-node-library, `:node-library` target>> instead since it allows for a finer level of control over exports and optimization.
2122

0 commit comments

Comments
 (0)