grunt-browserify icon indicating copy to clipboard operation
grunt-browserify copied to clipboard

Using the require option

Open rjbergerud opened this issue 9 years ago • 2 comments

I'm wondering if someone can post an example of using this options. While in browserify, this runs fine: browserify -r ./public/js/productionJS/recommendationConcatFooter.js:selector > ./public/js/productionJS/recommendationFooter.js

but in my gruntfile,

footer: {
                src: ['public/js/productionJS/recommendationConcatFooter.js'],
                dest: 'public/js/productionJS/recommendationFooter.js',
                options: {
                    debug: true,
                    require: ['./public/js/productionJS/recommendationConcatFooter.js:selector']

                }
            }

doesn't return any errors when I run grunt, but when I go to include the module selector in a script tag, I get a 'can't find module selector' error.

rjbergerud avatar Jul 10 '15 20:07 rjbergerud

Remove the file from your src. Just keep src: []

tleunen avatar Jul 23 '15 00:07 tleunen

To generate a separate bundle for project libraries, I do this:

plugins: {
  options: {
    debug: true,
    require: [
      'jquery',
      'underscore',
      'backbone',
      'backbone.marionette'
    ]
  },

  files: {
    '<%= paths.dist.base %>/plugins.js': []
  }
}

Apparently, it works fine.

HenriqueSilverio avatar Sep 22 '15 13:09 HenriqueSilverio