I have a directory structure as follows.
|-- app.js
|-- config.js
|-- index.html
|-- js
| |-- firstpage
| | `-- firstpage.js
| |-- lib
| | `-- jquery-3.2.0.min.js
| `-- secondpage
| `-- secondpage.js
`-- require.js
app.js
define(function(require, module){
var $ = require("jquery"),
firstpage = require("./firstpage/firstpage"),
secondpage = require("./secondpage/secondpage");
})
if I load index.html in browser "firstpage" and "secondpage" loads properly.
but what i am looking for is to load these scripts as follows with just the name:
firstpage = require("firstpage"),
secondpage = require("secondpage");
I found "paths" attribute to be useful in docs, but this seems to be overkill when i have large number of files which i want to load and would need to give separate entry for each of the file.
Can someone please suggest a better way to achieve this ?
There seems to be a lot of noise(for the lack of better word) around this on internet but i am unable to narrow down to the exact solution using those (there is duplicate question as well which does not seem to answer this)