bobthekingofegypt / dagre-reactjs

React component for rendering a dagre graph layout without any dependency on d3
MIT License
28 stars 8 forks source link

Dagre-reactjs with vitejs #16

Closed Manubi closed 2 years ago

Manubi commented 2 years ago

Hi, I moved my project from create-react-app to vitejs. Now I am facing a strange problem... on localhost everything is working fine, but as soon as I deploy it I get the following error. CleanShot 2022-03-08 at 14 49 57 Any ideas/help is appreciated!

CleanShot 2022-03-08 at 15 19 51@2x

Thanks

bobthekingofegypt commented 2 years ago

Hello,

I've been out of the front end game for a while now to the point I hadn't even heard of vitejs. I have taken a look at this and it's more of a problem with dagre + vitejs.

Try adding ignoreTryCatch to you vite config file.

defineConfig({
  ...
  build: {
    commonjsOptions: {
      ignoreTryCatch: false,
    }
  }
  ...
})

As detailed in this ticket https://github.com/vitejs/vite/issues/5759, and see if that gets you up and running.

Cheers Bob