Uncaught SyntaxError: redeclaration of import LitElement3k1axR86sr.js:3:9note: Previously declared at line 1, column 9
One way to fix this would be to add an async callback to the bundles option which provides an api to collect sources and write outputs, or to do so in the transforms option.
eleventyConfig.addPlugin(bundlerPlugin, {
transforms: [
async function(content, collect) {
// this.type returns the bundle name.
if (this.type === 'js' &&
// proposal: this.attributes exposes the source element's attributes
this.attributes.type === 'module') {
collect(this, content);
return false; // don't bundle, instead hold the item in memory
}
},
async function(content) {
if (this.type == bundlerPlugin.collection) { // a Symbol()
const { build } = await import('esbuild');
const result = await build({
bundle: true,
/* ... collected has source strings and metadata, etc */
entryPoints: writeToTmpAndMakeEntryPointsConfig(collected),
});
const [{ path, contents }] = result.outputFiles;
return {
url: path,
content: contents,
}
}
}
],
});
above APIs are proposals for discussion only, salt to taste.
ab.webc:
cd.webc:
index.webc:
One way to fix this would be to add an async callback to the
bundles
option which provides an api to collect sources and write outputs, or to do so in thetransforms
option.above APIs are proposals for discussion only, salt to taste.