Skip to content

Commit

Permalink
Restore bundlePluginOptions.hoistDuplicateBundlesFor defaults.
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Jan 28, 2025
1 parent 8a2e84d commit 5e054ad
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions eleventyWebcPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ module.exports = function(eleventyConfig, options = {}) {
scopedHelpers: ["css", "js", "html"],
useTransform: false, // global transform
transformData: {}, // extra global data for transforms specifically
bundlePluginOptions: {},
}, options);

options.bundlePluginOptions = Object.assign({
hoistDuplicateBundlesFor: ["css", "js"]
}, options.bundlePluginOptions);

if(options.components) {
let components = options.components;
if(!Array.isArray(components)) {
Expand All @@ -46,15 +49,19 @@ module.exports = function(eleventyConfig, options = {}) {
}
}

// v0.12.0 upstream `bundlePluginOptions.toFileDirectory` (via Bundle Plugin changes) default changed from "bundle" to ""
// v0.12.0 upstream
// `bundlePluginOptions.toFileDirectory` (via Bundle Plugin changes) default changed from "bundle" to ""
// https://github.com/11ty/eleventy-plugin-bundle/releases/tag/v2.0.0
let htmlBundleOptions = Object.assign({}, options.bundlePluginOptions, {
hoist: false, // don’t hoist
});

eleventyConfig.addBundle("html", htmlBundleOptions);
eleventyConfig.addBundle("css", options.bundlePluginOptions);
eleventyConfig.addBundle("js", options.bundlePluginOptions);
eleventyConfig.addBundle("html", Object.assign({}, options.bundlePluginOptions, {
hoist: options.bundlePluginOptions.hoistDuplicateBundlesFor.includes("html"),
}));
eleventyConfig.addBundle("css", Object.assign({}, options.bundlePluginOptions, {
hoist: options.bundlePluginOptions.hoistDuplicateBundlesFor.includes("css"),
}));
eleventyConfig.addBundle("js", Object.assign({}, options.bundlePluginOptions, {
hoist: options.bundlePluginOptions.hoistDuplicateBundlesFor.includes("js")
}));

templatePlugin(eleventyConfig, options);

Expand Down

0 comments on commit 5e054ad

Please sign in to comment.