Require js optimizer relative path issue

I am trying to do the browser example of require optimizer.I have my folder structure like this and the r.js and build.html are in same level as js folder

js
    lib
    |   a.js
    |   b.js
    |   c.js
    scripts
    |   1.js
    |   2.js
    |   3.js
    main.js

in main.js i have specified the path like this

require.config({
   baseUrl : 'js',
    paths: {
        '1' : 'scripts/1',
        '2' : 'scripts/2',
        '3' : 'scripts/3',

    }
});

and im including the scripts in modules like

define(function (require, exports, module) {
    "use strict";

    //load Modules
    var one = require('1'),
        two = require('2'),
        three = require('3');
      ......
      .....
})

and my build.htnl has config like this

{
    baseUrl: 'js',
    mainConfigFile: 'js/main.js',
    name: 'main',
    optimize: 'none',
    out: function (text) {
        document.getElementById('output').value = text;
    }               
}

but its not building , i can see 1,2,3 files are properly loaded by r (in network of dev tool i saw) , but getting a path error like root/js/js/lib/a.js ,

don't know why the js/js is repeating since 1,2,3 files are loaded properly.I tried some combination with remove 'js' from build add '.' etc.. non of the combination is not working .

What is the actual error in relative path.. what path i should specify in main and build config?

Thanks in advance

Ok.. finally i figured out the paths issues.

I was loading files in lib in other file like require('js/lib/a'),require('js/lib/b') etc.

When i add this also as path the issue is solved.

paths: {
        '1' : 'scripts/1',
        '2' : 'scripts/2',
        '3' : 'scripts/3',
        'a' : 'libs/a',
        'b' : 'libs/b',
        'c' : 'libs/c'

    }

and for avoid confusion keep this in mind

  • Use common baseUrl for main file and build file.