eta-dev / eta

Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript

Home Page:https://eta.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support for cloudflare workers

maxjoygit opened this issue · comments

if possible :)

@maxjoygit can you provide an example? I would think that it should already work.

X [ERROR] Could not resolve "node:path"

node_modules/eta/dist/eta.module.mjs:1:22:
  1 │ import * as path from 'node:path';
    ╵                       ~~~~~~~~~~~

You can mark the path "node:path" as external to exclude it from the bundle, which will remove this error.

X [ERROR] Could not resolve "node:fs"

node_modules/eta/dist/eta.module.mjs:2:20:
  2 │ import * as fs from 'node:fs';
    ╵                     ~~~~~~~~~

You can mark the path "node:fs" as external to exclude it from the bundle, which will remove this error.

X [ERROR] Build failed with 2 errors:

node_modules/eta/dist/eta.module.mjs:1:22: ERROR: Could not resolve "node:path"
node_modules/eta/dist/eta.module.mjs:2:20: ERROR: Could not resolve "node:fs"

@maxjoygit from https://developers.cloudflare.com/workers/runtime-apis/nodejs/path/:

To use Node.js APIs in your Worker, add the nodejs_compat compatibility flag to your wrangler.toml file.

I did, but not working
Can I have working example app?

@maxjoygit sorry, I don't have any working examples to share right now.