user2325247
user2325247

Reputation: 814

Require JS optimization

I have around 50 JS files and I have to optimize it using r.js and node... I dont want to specify all the JS files, instead specify the top level folder and somehow let r.js to get all the required js files....

Is there a way to achieve this? Currently I am specifying all the 50 js files in a common js files and referring it in my build.js...I have more files in the coming weeks, and so maintaining a common js file will be a pain.

Please suggest some steps.

here is my build file

({   
    baseUrl: ".",
    mainConfigFile: "../App/main.js",
    //modules: [
    //   //{ name: "../App/Crosspoint/Address/AddressList" }
    //   { name: "../App/Crosspoint/Office/OfficeDetails" }
    //],
    //paths: {
    //    app: '../App',
    //    jquery: 'jquery'
    //},
    name: "../App/Crosspoint/Office/OfficeDetails",
    deps: ["../App"],
    out: "main-built123.js",
    rawText: {
        'some/id': 'define(["another/id"], function () {});'
    },
   // dir: "app",    
})

Upvotes: 1

Views: 443

Answers (1)

Tomas Kirda
Tomas Kirda

Reputation: 8413

Optimizer should include all the dependencies required by main config file. Also if you have nested dependencies then specify:

findNestedDependencies: true

Upvotes: 1

Related Questions