Giter Club home page Giter Club logo

Comments (3)

SebastianS90 avatar SebastianS90 commented on June 29, 2024

I'm currently working on the next release of this plugin. It will be possible to create one asset for each combination of needed polyfills. For example, if you configure that polyfills A, B and C are required, then webpack bundles assets for A, B, C, AB, AC, BC, ABC and the entry chunk will load the required one. The server does not need to do anything special because it just serves a static file that is contained in the bundle.
Of course, the overall bundle size will increase, but only one file per client is needed and it does not contain unnecessary polyfills, so it actually saves bandwidth.

Would that fit your needs, or do you need to rely on a polyfill-service that dynamically serves the files instead of generating every possible option at build time?

(There will still be the option to bundle only a single file contrasting all polyfills)

from webpack-polyfill-injector.

SebastianS90 avatar SebastianS90 commented on June 29, 2024

The new version 1.0.0 with the change mentioned above is currently in the develop branch and can be installed using the @beta tag:

yarn add webpack-polyfill-injector@beta --dev
npm install webpack-polyfill-injector@beta --save-dev

Does that fit the needs requested here?

from webpack-polyfill-injector.

SebastianS90 avatar SebastianS90 commented on June 29, 2024

1.0.0 has been released and supports the following configuration:

    entry: {
        entry1: `webpack-polyfill-injector?${JSON.stringify({
            modules: ['./src/entry1.js'],
            polyfills: ['Promise', 'Array.prototype.find'],
        })}!`,
        entry2: `webpack-polyfill-injector?${JSON.stringify({
            modules: ['./some-vendor-script-that-will-be-loaded-first.js', './src/entry2.js'],
            polyfills: ['String.prototype.startsWith'],
        })}!`,
    },

If you have other requirements that are not possible with the new update then please open a new issue explaining the use-case. Thanks!

from webpack-polyfill-injector.

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.