RequireJS alias example
// current solution. pretty ugly. got a lot of code like this in my app :(
define(['../../utils/devices', '../../utils/math', '../../utils/paint',
'../../configuration/configuration', '../../libs/color',
'../../tools/tools', '../panels'],
function(devices, math, paint, conf, color, tools, panels) {
...
}
// nicer solution
define(['devices', 'math', 'paint', 'configuration', 'color', 'tools', 'panels'],
function(devices, math, paint, conf, color, tools, panels) {
...
}
// in this case build conf (build.js) would look something like this
{
appDir: "my_app",
baseUrl: "src",
dir: "build",
optimize: "none",
aliases: {
'path/to/dep': 'math', // maps to 'math' import
...
}
modules: [
{
"name": "main"
}
]
}
// should using 'paths' prop achieve the same thing?