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

Using blocks on Cloudflare Workers #13

Open
elmarw opened this issue Jan 13, 2022 · 0 comments
Open

Using blocks on Cloudflare Workers #13

elmarw opened this issue Jan 13, 2022 · 0 comments

Comments

@elmarw
Copy link

elmarw commented Jan 13, 2022

I am running some tests on Cloudflare Workers using the example in your repo. However I cant seem to get the Blocks to work.

esbuild.js:

require('esbuild').build({
	bundle: true,
	entryPoints: ['workers-site/index.js'],
	outfile: 'dist/index.js',
	format: 'esm',
	plugins: [
		require('tempura/esbuild').transform({
      blocks: {
        foo(args) {
          return args.test
        }
      }
    })]
});

test.hbs

{{#foo test="bar" }}

worker.js

import test from "./test.hbs"
addEventListener('fetch', event => {
  event.respondWith(new Response(test()))
})

Results in: Cannot read properties of undefined (reading 'foo')

Would it be possible to get a working example including blocks for Cloudflare Workers maybe?

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