Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for factor-bundle plugin #18

Closed
gsantiago opened this issue Feb 13, 2017 · 1 comment
Closed

Add support for factor-bundle plugin #18

gsantiago opened this issue Feb 13, 2017 · 1 comment

Comments

@gsantiago
Copy link

It would be awesome if simplifyify could support the factor bundle plugin. This saves a lot of bytes when We have to include multiple bundles in a same page.

Let's say I have two entry-points: x.js and y.js with both sharing modules in common.

We could run the following command to create the bundles:

simplifyify source/*.js -o dist/*.bundle.js

This will create two bundles: x.bundle.js and y.bundle.js. But both will have the same modules in common in each bundles. This is not good if We need to include both bundles in a same page.

So, we could add the factor-bundle option to resolve this problem:

simplifyify source/*.js -o dist/*.bundle.js --factor-bundle dist/common.bundle.js

This option would extract the common modules between the bundles into the common.bundle.js file.

@stringparser
Copy link

stringparser commented Mar 3, 2017

Actually I'm in the same situation. Searching for a browserify option for the common bundle end up here.

It might still be possible. In the factor-bundle readme it says:

you can pipe module-deps json directly into the factor-bundle command:

$ module-deps x.js y.js | factor-bundle \
  x.js -o bundle/x.js \
  y.js -o bundle/y.js \
  > bundle/common.js

or factor out an existing bundle already compiled by browserify:

$ browserify x.js y.js > bundle.js
$ browser-unpack < bundle.js | factor-bundle \
  x.js -o bundle/x.js \
  y.js -o bundle/y.js \
  > bundle/common.js

Have to try it.

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

No branches or pull requests

2 participants