eleventy icon indicating copy to clipboard operation
eleventy copied to clipboard

getBundle in serverless only running on first invocation

Open timonforrer opened this issue 1 year ago • 3 comments

Operating system

macOS Sonoma 14.2.1 (23C71)

Eleventy

2.0.2-alpha.2

Describe the bug

I'm using Eleventy Serverless in dynamic template rendering mode to render previews of the site before they get published in the CMS.

The preview works fine so far. However, only on the first render. As soon as I reload the page or want to preview another document, the CSS and JS that gets generated using getBundle('css') and getBundle('js') are empty.

I'm generating the styles and scripts as follows:

<style @raw="getBundle('css')" webc:keep></style>

...

<script @raw="getBundle('js')" webc:keep></script>

Reproduction steps

  1. Goto https://11ty-get-bundle-test.netlify.app/preview/modular/?id=page-one
  2. Reload the page

Expected behavior

getBundle should run on every invocation of serverless function.

Reproduction URL

https://github.com/timonforrer/11ty-get-bundle-test

Screenshots

No response

timonforrer avatar Jan 25 '24 13:01 timonforrer