Skip to content
This repository has been archived by the owner on Nov 4, 2021. It is now read-only.

ability to split the vendor and app bundles #4

Open
ksachdeva opened this issue Apr 7, 2016 · 5 comments
Open

ability to split the vendor and app bundles #4

ksachdeva opened this issue Apr 7, 2016 · 5 comments

Comments

@ksachdeva
Copy link

I was using webpack earlier and though managed to use it successfully for a complex build, I was never happy with the abstraction that it provided and had to do lot of search to find the right syntax and command.

I like the gulp and browserfiy approach however I am missing the generation of two bundles - one that has all vendor scripts (ionic, angular, lodash, rxjs etc) and other that only has my app.

How should I one achieve this using this new gulp based system ?

Regards & thanks
Kapil

@tlancina
Copy link
Contributor

tlancina commented Apr 7, 2016

I'm curious about this myself, as I think it would potentially speed up build times. There's a nice writeup by the author of browserify on doing common webpack tasks with browserify: https://gist.github.com/substack/68f8d502be42d5cd4942 which might be a good starting point, I just haven't looked into how the app bundle requires the vendor bundle.

@dmackerman
Copy link

With webpack 2, there's a pretty easy way to do this. We're using something like this on our webpack build for Ionic.

    entry: {
        js: path.resolve(__dirname, 'app/app.ts'),
        vendor: [
            path.normalize('es6-shim/es6-shim.min'),
            'reflect-metadata',
            'zone.js/dist/zone',
            'ionic-angular'
        ]
    }

Then use the CommonChunksPlugin:

new webpack.optimize.CommonsChunkPlugin({
    name: 'vendor',
    minChunks: Infinity,
    filename: 'vendor.bundle.js'
}),

Outputs a vendor.bundle and vendor.bundle.map.

@ksachdeva
Copy link
Author

Yes I was using this approach with webpack (before switching to browserify) to split the vendor and app bundles. There is another article https://lincolnloop.com/blog/speedy-browserifying-multiple-bundles/ that talks about it on how to do it for browserify.

@dmackerman
Copy link

I'm curious on your reasons for switching to Browserify. Our team has found Webpack to be a superior tool in nearly every aspect - especially speed and incremental builds.

My apologies for the post above. I thought you were looking for a webpack solution. 😄

@tlancina
Copy link
Contributor

tlancina commented Apr 7, 2016

Optimizing for ease of use, low barrier to start, with the idea that if you
know what you're doing, then you already know what you're doing and getting
setup with an alternative like webpack (which we support) shouldn't be too
hard. The docs on all of this are lacking at the moment but will be super
awesome eventually :)

On Thu, Apr 7, 2016 at 11:53 AM Dave Ackerman [email protected]
wrote:

I'm curious on your reasons for switching to Browserify. We've found
Webpack to be a superior tool in nearly every aspect - especially speed and
incremental builds.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#4 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants