jrburke/r.js — Issue #101: minification/concatenation no longer outputs to 'dir' config option as of 1.0.5
Author: kc0dhb
Created: 2012-02-14 18:26:19+00:00
State: open

1.0.5 seems to have introduced a change where the 'dir' configuration option is ignored for the final concatenation. The issue also exists in 1.0.6. The result is overwriting of src files by the optimizer. Am I missing a configuration option? or did something change? Also, it is concatenating the unminified (uglify) files, doesn't even attempt to concatenate the minified files as in prior versions.

I can upload the full simple test case if that would help.

This uglifies all files in target/minified, but outputs the final concatenation to the src directory.

```
byerlyk@pi:~/tmp/requirejs-1.0.5-fail$ sh optimize-node.sh

Tracing dependencies for: lang/es

Tracing dependencies for: core/all-require
Uglifying file: /home/byerlyk/tmp/requirejs-1.0.5-fail/target/minified/js/core/all-require.js
Uglifying file: /home/byerlyk/tmp/requirejs-1.0.5-fail/target/minified/js/core/lang/etwas-en.js
Uglifying file: /home/byerlyk/tmp/requirejs-1.0.5-fail/target/minified/js/core/lang/es.js
Uglifying file: /home/byerlyk/tmp/requirejs-1.0.5-fail/target/minified/js/core/lang/etwas-es.js
Uglifying file: /home/byerlyk/tmp/requirejs-1.0.5-fail/target/minified/js/core/lang/en.js
Uglifying file: /home/byerlyk/tmp/requirejs-1.0.5-fail/target/minified/js/lib/jquery-1.7.1.js
Uglifying file: /home/byerlyk/tmp/requirejs-1.0.5-fail/target/minified/js/lib/require.js

/home/byerlyk/tmp/requirejs-1.0.5-fail/src/main/webapp/js/core/lang/es.js
----------------
/home/byerlyk/tmp/requirejs-1.0.5-fail/src/main/webapp/js/core/lang/etwas-es.js
/home/byerlyk/tmp/requirejs-1.0.5-fail/src/main/webapp/js/core/lang/es.js

/home/byerlyk/tmp/requirejs-1.0.5-fail/src/main/webapp/js/core/all-require.js
----------------
/home/byerlyk/tmp/requirejs-1.0.5-fail/src/main/webapp/js/lib/jquery-1.7.1.js
/home/byerlyk/tmp/requirejs-1.0.5-fail/src/main/webapp/js/core/all-require.js
/home/byerlyk/tmp/requirejs-1.0.5-fail/src/main/webapp/js/core/lang/etwas-en.js
/home/byerlyk/tmp/requirejs-1.0.5-fail/src/main/webapp/js/core/lang/en.js
```

This one is with 1.0.4 and it works as expected (and as all prior versions).

```
byerlyk@pi:~/tmp/requirejs$ sh optimize-node.sh

Tracing dependencies for: lang/es

Tracing dependencies for: core/all-require
Uglifying file: /home/byerlyk/tmp/requirejs/target/minified/js/core/all-require.js
Uglifying file: /home/byerlyk/tmp/requirejs/target/minified/js/core/lang/etwas-en.js
Uglifying file: /home/byerlyk/tmp/requirejs/target/minified/js/core/lang/es.js
Uglifying file: /home/byerlyk/tmp/requirejs/target/minified/js/core/lang/etwas-es.js
Uglifying file: /home/byerlyk/tmp/requirejs/target/minified/js/core/lang/en.js
Uglifying file: /home/byerlyk/tmp/requirejs/target/minified/js/lib/jquery-1.7.1.js
Uglifying file: /home/byerlyk/tmp/requirejs/target/minified/js/lib/require.js

js/core/lang/es.js
----------------
js/core/lang/etwas-es.js
js/core/lang/es.js

js/core/all-require.js
----------------
js/lib/jquery-1.7.1.js
js/core/all-require.js
js/core/lang/etwas-en.js
js/core/lang/en.js
```

```
byerlyk@pi:~/tmp/requirejs$ cat optimize-node.sh
#!/bin/bash
BUILD=src/main/build
rm -rf target/minified &&
node ${BUILD}/r.js -o ${BUILD}/app.build.js
```

```
byerlyk@pi:~/tmp/requirejs$ cat src/main/build/app.build.js
({
appDir: "../webapp/",
baseUrl: "js",
// ui-js/target/minified
dir: "../../../target/minified",
paths : {
jquery : 'lib/jquery-1.7.1',
lib : 'lib',
core : 'core',
lang : 'core/lang'
},
modules: [
{
name: "lang/es"
},
{
name: "core/all-require",
include: [
"lang/en"
],
exclude: [
"lang/es"
]
}
],
optimize: "uglify",
//optimize: "none",
//uglify: {
// gen_codeOptions : {
// beautify: true,
// }
//},
findNestedDependencies: true,
skipModuleInsertion: false
})

```

```
byerlyk@pi:~/tmp/requirejs$ node --version
v0.5.11-pre
```