简体   繁体   中英

Gulp Browserify combine JS

I am using Browserify with Gulp to handle external Javascript library requirements.

I want to combine all my non-external libraries into one file as well and can't seem to find any documentation on their site about how to do it (and Googling "browserify bundleConfigs" doesn't seem to come up with anything helpful. This is my current configuration:

browserify: {
    bundleConfigs: [
        {
            entries: SRC + '/javascript/functions.js',
            dest: DEST + '/js/',
            outputName: 'functions.js',
            require: ['jquery', 'backbone/node_modules/underscore', 'backbone']
        }
    ]
}

I also tried:

 entries: [ SRC + '/javascript/functions.js', SRC + 'javascript/menu.js' ]

But that doesn't seem to work either. Has anyone else managed to get this working, or is there a different way I am supposed to be doing this?

Thanks

Figured out I could do this with:

require('./myfile'); //not `./myfile.js`

In the base javascript file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM