2

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

Deeptechtons
  • 10,945
  • 27
  • 96
  • 178

1 Answers1

3

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.

Waxen
  • 1,792
  • 2
  • 27
  • 27
  • Yup `True app.js` has all of the code in compressed including **text plugin** which is required across `multiple projects`. Is there any way to **exclude it** so that it can be loaded async and keep project files intact – Deeptechtons Nov 21 '12 at 03:53
  • @Deeptechtons You're trying to exclude just the text plugin? In your modules config for "app", just add `exclude: [ '../../amd/plugins/text' ]`. Also, maybe take a look at this: https://github.com/jrburke/r.js/blob/master/build/example.build.js It has examples of all of the available options. – Waxen Nov 21 '12 at 15:48