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

Give jquip a handle function, in case a module needs to be loaded #57

Open
IngwiePhoenix opened this issue May 2, 2015 · 0 comments
Open

Comments

@IngwiePhoenix
Copy link

I am using WebPack to compile my JavaScript resources and alike into a single JavaScript and CSS file. Long story short; I realized how jQuery takes ~250kb of my script. Now add the unoptimized bulk of Socket.IO (300kb) and Bootstrap (you can guess it...) and you sit in my situation with this at the top of the webpack output:

Version: webpack 1.8.9
Time: 3178ms
                                 Asset       Size      Chunks             Chunk Names
  3daa08fd071dfaad35ca6f2954714881.jpg    1.09 MB              [emitted]  
  f4769f9bdb7466be65088239c12046d1.eot    20.1 kB              [emitted]  
 fa2772327f55d8198301fdb8bcfc8158.woff    23.4 kB              [emitted]  
  e18bbf611f2a2e43afc071aa2f4e1512.ttf    45.4 kB              [emitted]  
  89889688147bd7575d6327160d64e760.svg     109 kB              [emitted]  
  f7c2b4b747b1a225eb8dee034134a1b0.eot    60.8 kB              [emitted]  
97493d3f11c0a3bd5cbd959f5d19b699.woff2    56.8 kB              [emitted]  
 d9ee23d59d0e0e727b51368b458a0bff.woff    71.5 kB              [emitted]  
  706450d7bba6374ca02fe167d86685cb.ttf     122 kB              [emitted]  
  2980083682e94d33a66eef2e7d612519.svg     313 kB              [emitted]  
  2516339970d710819585f90773aebe0a.png    12.8 kB              [emitted]  
448c34a56d699c29117adc64c43affeb.woff2      18 kB              [emitted]  
  089d2e0083252f402c6b5888fe27eab4.jpg    23.4 kB              [emitted]  
  98e3f8fbdac57fef3d6d239da334e924.png    69.3 kB              [emitted]  
  60031ca76bf60b012afc26c5a96c8b67.png    14.1 kB              [emitted]  
  0f24b53179ba5959ed8227eb79b8c97b.png    21.8 kB              [emitted]  
          6e57378d03faae1b5d08-main.js     716 kB        0, 2  [emitted]  main <--------- Gulp...
           1.6e57378d03faae1b5d08-1.js     508 kB        1, 2  [emitted]  
    6e57378d03faae1b5d08-libwebpack.js    3.76 kB           2  [emitted]  libwebpack
         6e57378d03faae1b5d08-main.css     260 kB        0, 2  [emitted]  main
       6e57378d03faae1b5d08-main.0.map  106 bytes  0, 2, 0, 2  [emitted]  main, main
          6e57378d03faae1b5d08-1.1.map     555 kB        1, 2  [emitted]  
 6e57378d03faae1b5d08-libwebpack.2.map     3.8 kB           2  [emitted]  libwebpack

So I found jquip. But if you thought a step ahead, you'd realize that WebPack is ment to compile everything at once, into one thing. It does have a function to asyncronously load additional chunks - and you can see that in the above output too. It contains the entireness of HighlightJS. it is loaded conditionaly, if there is one or more <code><pre>...</pre></code> sets present.

Now, imagine I dropped jquip in and lets just assume all the plugins and bootstrap would just work... what would happen, if I was to have a client with an older browser? jquip would normally load the Sizzle.js via cdnjs. But what, if I already bundled Sizzle and would want to intercept the sizzle download and instead just require and return it from an additional chunk of data, for example?

Therefore I am proposing a feature request, pretty much. It'd be awesome if you could have people get the ability to sneakily intercept these "if not exist then download" lines with something more fitting for their system - i.e., when using RequireJS already.

I hope to use jquip in the future and I will see how far I can get bootstrap to work ontop of it. Because it would be handy to strip away ~200KB of code I'd barely ever use.

Kind regards,
Ingwie!

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

1 participant