eta-dev / eta

Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript
https://eta.js.org
MIT License
1.35k stars 60 forks source link

ETA cannot be rolled up into a web project due to 2 dependencies #242

Closed daredoes closed 12 months ago

daredoes commented 1 year ago

Describe the bug ETA is unable to be used in certain projects due to the usage of node:fs and node:path.

To Reproduce Build a library using RollupJS that uses Eta

Expected behavior The library builds

Screenshots If applicable, add screenshots to help explain your problem.

image

Package & Environment Details

Additional context I was able to solve this in my own fork by completely removing the usage of file-handler.ts. It would be great to have file-handler.ts be its own package that can be added into Eta during the configuration.

nebrelbug commented 1 year ago

@daredoes try importing from "eta/dist/browser.umd.js" or "eta/dist/browser.module.mjs".

visoft commented 1 year ago

I'm using deno in an edge function, and it doesn't have node:fs or node:path.

I'm seeing

Failed to load module: "node:path" - Unsupported scheme "node" for module "node:path". Supported schemes: [
    "data",
    "blob",
    "file",
    "http",
    "https",
]

Right when I call new Eta()

visoft commented 1 year ago

I got around the issue by using:

import { Eta } from "https://deno.land/x/eta@v3.0.3/src/core.ts";

nebrelbug commented 1 year ago

@visoft I think the issue is your Deno version. Which are you using? It will likely need to be 1.31.0 or later.