Skip to content

Commit b1f924d

Browse files
committed
update doc on mainConfigFile, correct the example and hopefully make more sense.
1 parent 14ba560 commit b1f924d

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

docs/optimization.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,15 +385,15 @@ <h2><a href="#pitfalls" name="pitfalls">Common pitfalls</a><span class="sectionM
385385

386386
<p><strong>Config settings in your main JS file are not read by default by the optimizer</strong></p>
387387

388-
<p>This is because the config settings for a build can be very different, with multiple optimization targets.</p>
388+
<p>This is because the config settings for a build can be very different, with multiple optimization targets. So a separate set of config options need to be specified for the optimizer.</p>
389389

390-
<p>However, in version 1.0.5+ of the optimizer, there is now a <strong><a href="https://github.com/jrburke/r.js/blob/master/build/example.build.js#L27">mainConfigFile</a></strong> option. If specified with the path to your main JS file, any <code>requirejs({}), requirejs.config({}), require({}), or require.config({})</code> call will have the config parsed out and used in the build:</p>
390+
<p>In version 1.0.5+ of the optimizer, there is now a <strong><a href="https://github.com/jrburke/r.js/blob/master/build/example.build.js#L27">mainConfigFile</a></strong> option. If specified with the path to your main JS file, the first <code>requirejs({}), requirejs.config({}), require({}), or require.config({})</code> found in that file will be parsed out and used as part of the configuration options passed to the optimizer:</p>
391391

392-
<pre><code>paths: {
393-
main: '../main'
394-
}
392+
<pre><code>mainConfigFile: 'path/to/main.js'
395393
</code></pre>
396394

395+
<p>The precedence for config: command line, build profile, mainConfigFile. In other words, the mainConfigFile configuration has the lowest priority.</p>
396+
397397
<p><strong>Do not specify the output directory to within the source area for your JavaScript</strong></p>
398398

399399
<p>For instance, if your baseUrl is 'js' and your build output goes into 'js/build', there will likely be problems with extra, nested files generated on each optimization run. This guidance is only for optimizations that are not single file optimizations.</p>

0 commit comments

Comments
 (0)