Deeptechtons
Deeptechtons

Reputation: 11125

Requirejs Optimize project to single file

With a Build configuration as below, Why am i seeing all the files in source directory + minified application file when i run the deploy command specified below. I only need a single js file that will kickoff my backbone application

Build Config

({
    appDir: "../",
    baseUrl: 'Comment',
    dir: './deploy',
    optimize: 'uglify',
    paths: {
        text: '../../amd/plugins/text',
        CommentView: 'views/feedback',
        Feedback: 'models/feedback',
        templates: 'templates'
    },
    modules: [
        {
            name: "app"
        }
    ]
})

App.js

require.config({
    urlArgs: "bust=" + (new Date()).getTime(),
    baseUrl: 'scripts/apps/feedback',
    paths: {
        text: '../../amd/plugins/text',
        CommentView: 'views/feedback',
        Feedback: 'models/feedback',
        templates: 'templates'
    }
});

require(["Feedback", "CommentView"], function (feedbackModel, commentView) {
});

Optimization Command

node amd/plugins/r.js -o apps/feedback/build.config.js

Upvotes: 2

Views: 1823

Answers (1)

Waxen
Waxen

Reputation: 1782

By default, the requirejs optimizer does not remove modules from the output. Check the contents of your built app.js, I would guess that it has all of your modules in it. The individual modules shouldn't cause any problems and won't be used, but if you really went to get rid of them, try setting removeCombined: true in your build config.

Upvotes: 3

Related Questions