Skip to content

Commit

Permalink
Merge pull request #20715 from emberjs/prune-empty-modules
Browse files Browse the repository at this point in the history
Don't publish empty modules
  • Loading branch information
ef4 authored Jul 11, 2024
2 parents a5e33a1 + 70caf04 commit e8176ff
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function esmConfig() {
resolveTS(),
version(),
resolvePackages(exposedDependencies(), hiddenDependencies()),
pruneEmptyBundles(),
],
};
}
Expand Down Expand Up @@ -443,7 +444,7 @@ function templateCompilerConfig() {
});
config.output.globals = (id) => {
return `(() => {
try {
try {
return require('${id}');
} catch (err) {
return ${externals[id]}
Expand All @@ -452,3 +453,16 @@ function templateCompilerConfig() {
};
return config;
}

function pruneEmptyBundles() {
return {
name: 'prune-empty-bundles',
generateBundle(options, bundles) {
for (let [key, bundle] of Object.entries(bundles)) {
if (bundle.code.trim() === '') {
delete bundles[key];
}
}
},
};
}

0 comments on commit e8176ff

Please sign in to comment.