patternfly / react-topology

MIT License
10 stars 19 forks source link

Using vite as bundler breaks the application #96

Closed lordrip closed 11 months ago

lordrip commented 1 year ago

Describe the problem The SVGArrowMarker component tries to use the global object. When using vite as a bundler, this object seems to not be available, therefore making the application crash.

How do you reproduce the problem?

  1. Checkout this branch
  2. Install dependencies with yarn install
  3. Run yarn workspace @kaoto-next/ui run start
  4. Open the following URL http://localhost:5173/#/
  5. Notice the stack-trace in the console.

Expected behavior When using vite it should work.

Is this issue blocking you? Following this answer on SO helped.

In a nutshell, adding:

    <script type="module">
      window.global ||= window;
    </script>

into the index.html helped, but the problem will continue if vite is used as a library bundler since the consumer would need to add the workaround as well.

Screenshots

Stacktrace

image

Component source code

image

What is your environment?

What is your product and what release date are you targeting?

Any other information?

nicolethoen commented 1 year ago

It's worth attempting to evaluate and possibly remove references to 'global' and 'window' in general since that makes it much more difficult to bundle topology.

github-actions[bot] commented 11 months ago

:tada: This issue has been resolved in version 5.2.0-prerelease.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: