Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Supplying custom Output filename #2

Open
seangwright opened this issue Mar 20, 2022 · 0 comments
Open

Docs: Supplying custom Output filename #2

seangwright opened this issue Mar 20, 2022 · 0 comments

Comments

@seangwright
Copy link

If I want to supply a custom output filename, I need to still supply output in the options, otherwise this library skips writing.

This is confusing!

const production = process.env.ELEVENTY_ENV === 'production';
const extension = production ? '.min' : '';

eleventyConfig.addPlugin(pluginESbuild, {
  entryPoints: {
    site: 'src/assets/scripts/site.js',
  },
  output: '_site/assets/scripts', // supply a value to trick plugin to execute, but overidden with 'outfile' below
  esbuild: {
    bundle: production,
    format: 'esm',
    minify: production,
    sourcemap: true,
    outfile: `_site/assets/scripts/site${extension}.js`,
  },
});

I realize that output is a nice convenience, but the way it interacts with outfile is unexpected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant