Skip to content

Doesn't work in esm project #4

Description

@altano

I have a type: module project and it looks like that's tripping this library up. In canvaskit-wasm (a dep of the project) __dirname is used which results in this error:

▶ src/pages/articles/index.astro
  └─ /articles/index.html (+6ms)
 error   __dirname is not defined in ES module scope
  File:
    /Users/alan/src/alan.norbauer.com-astro-v2/dist/chunks/pages/open-graph.ts.6ecf069b.mjs:35419:43
  Code:
    35418 |   arguments.length;};})();})(w);var sa=Object.assign({},w),va="./this.program",wa=(a,b)=>{throw b;},xa="object"==typeof window,ya="function"==typeof importScripts,za="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,Ba="",Ca,Da,Ea,fs,Fa,Ga;
    > 35419 |   if(za)Ba=ya?require$$0$1.dirname(Ba)+"/":__dirname+"/",Ga=()=>{Fa||(fs=require$$1,Fa=require$$0$1);},Ca=function(a,b){Ga();a=Fa.normalize(a);return fs.readFileSync(a,b?void 0:"utf8")},Ea=a=>{a=Ca(a,!0);a.buffer||(a=new Uint8Array(a));return a},Da=(a,b,d)=>{Ga();a=Fa.normalize(a);fs.readFile(a,function(f,h){f?d(f):b(h.buffer);});},1<process.argv.length&&(va=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("unhandledRejection",function(a){throw a;}),wa=(a,b)=>{if(noExitRuntime)throw process.exitCode=
            |                                           ^

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions