rlaffers / xstate-ninja

Devtool for XState state machines
ISC License
69 stars 2 forks source link

ReferenceError: CustomEvent is not defined #1

Closed gordlea closed 2 years ago

gordlea commented 2 years ago

When trying to use xstate-ninja in a react/nextjs app, I am getting the following error:

event - compiled client and server successfully in 275 ms (522 modules)
error - ReferenceError: CustomEvent is not defined
    at file:///home/user/app/node_modules/xstate-ninja/dist/xstate-ninja.js:139:17
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:533:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15) {
  page: '/p/[rulesId]'
}
rlaffers commented 2 years ago

Is this in an SSR context? CustomEvent is available in browsers, I'm not sure about server rendered stuff.

gordlea commented 2 years ago

Yes, that's probably what it is.

alirezanobahari commented 1 year ago

So, what is the alternative approach in SSR projects?

rlaffers commented 1 year ago

In this stage, the SSR environments are not supported.