Giter Club home page Giter Club logo

Comments (5)

iLaurens avatar iLaurens commented on June 14, 2024

@igrigorik what are your thoughts on this?

from preload-webpack-plugin.

igrigorik avatar igrigorik commented on June 14, 2024

I don't think I have enough context here to make an informed comment.. what is the plugin preloading? Note the preload requires as, which specifies the type of resource being preloaded -- e.g. if you as=script then the priority of that resource is the same as fetching via <script>.

from preload-webpack-plugin.

addyosmani avatar addyosmani commented on June 14, 2024

My hypothesis is that default setup of this plugin could actually hurt performance. It adds the resource with the highest prio on the network queue.

I don't feel I'm following. The default setup here is structured around a developer preloading scripts they know are going to be used for the current session or closely thereafter - this isn't different to how one would manually go about tackling the problem. We don't encourage preloading all resources to avoid excessive network congestion etc.

Perhaps you could share a code sample of where you think the defaults might steer folks astray? Right now, it's been doing what I would expect correctly in my own apps.

from preload-webpack-plugin.

zcoding avatar zcoding commented on June 14, 2024

+1
When i first time found this plugin i thought that it would help me optimizing the performance of my site. But actually i was wrong. This plugin is not what i need: I expected the plugin to load some async chunks only after the resources which current page needs are loaded completely. Then when i go to another page the resources of that page are already loaded.

from preload-webpack-plugin.

addyosmani avatar addyosmani commented on June 14, 2024

Re-reading through this thread, it sounds like this is more of a documentation issue that I need to work on. The plugin has been written with enough flexibility to:

  1. Preload resources you've observed to be discovered late in your network waterfall. The onus is on the developer using the plugin to make the right choice of what resources need to be loaded with a higher priority. It definitely isn't the case that we expect every script generated from your Webpack pipeline to fall into this category. It just may be the case that many of these are needed for your SPA to get interactive sooner so preloading them sooner may be beneficial.

  2. Prefetch. While the plugin has preload in the name, I personally prefetch my lazy/async chunks while preloading my main bundles to ensure that I'm not running into too much network contention. We're definitely not trying to be too magical here with what is prescribed.

I'll take an AI to better reflect some of the nuance here in the README. In short, folks should be sure that preloading or prefetching specific resources are going to have a measurable improvement (with or without this plugin) - the plugin is there to help you avoid wiring challenges, in particular when your chunk names might be dynamically generated/done in a non-easily deterministic way.

from preload-webpack-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.