Closed zachleat closed 1 year ago
This behavior will be opt-in with the hoistDuplicateBundlesFor
option.
Usage:
const bundlerPlugin = require("@11ty/eleventy-plugin-bundle");
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(bundlerPlugin, {
hoistDuplicateBundlesFor: ["css", "js"],
});
};
Shipping with @11ty/eleventy-plugin-bundle
v1.0.2
Say this island exists in two separate independent sections of a WebC page:
Note that this means the same bucket CSS will exist in two places on the page
<style webc:keep @raw="getBundle('css', 'my-bucket')"></style>
.More simply, what should happen when we output the same non-
default
bundle twice?Or
In those cases I’d like to hoist the CSS from the
compare-defined
bucket intodefault
.Future versions of WebC will perform this bucket hoisting more intelligently inside of WebC at a component level.
This feature is specifically for the use case when
getBundle
is called more than once on a single page (orgetBundle
is used to output the same code asgetBundleFileUrl
).Notably, you exclusively use external files (
getBundleFileUrl
) to workaround this issue too but I think we can do better forgetBundle
.