8000 Latest build broken? ERROR in ./node_modules/graphology/dist/graphology.mjs 2:0-44 · Issue #115 · reaviz/reagraph · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Latest build broken? ERROR in ./node_modules/graphology/dist/graphology.mjs 2:0-44 #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
getnashty opened this issue Jul 31, 2023 · 14 comments
Labels
bug Something isn't working

Comments

@getnashty
Copy link

Describe the bug

I just installed reagraph in my project - version 4.11.1.. I tried the example in the readme:


import React from 'react';
import { GraphCanvas } from 'reagraph';

export default () => (
  <GraphCanvas
    nodes={[
      {
        id: 'n-1',
        label: '1'
      },
      {
        id: 'n-2',
        label: '2'
      }
    ]}
    edges={[
      {
        id: '1->2',
        source: 'n-1',
        target: 'n-2',
        label: 'Edge 1-2'
      }
    ]}
  />
);

And it kills the react client.. lots of errors like this:

(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.```

### Steps to Reproduce the Bug or Issue

Try a fresh install with version 4.11.1?

### Expected behavior

I expected it to work

### Screenshots or Videos

_No response_

### Platform

- Reagraph Version: 4.11.1
- OS: macOS
- Browser:  Chrome
- NodeJS version: 16.9.1
- React: 18.2.0


### Your Example Website or App

_No response_

### Additional context

_No response_
@amcdnl
Copy link
Member
amcdnl commented Jul 31, 2023

Can you provide more details like what build system you are using?

@getnashty
Copy link
Author

maybe I'm misunderstanding, but I believe its just create-react-app's default build system

@getnashty
Copy link
Author

https://codesandbox.io/s/reagraph-example-forked-8flnt8?file=/src/App.tsx I forked the example sandbox code and updated the package to 4.11.1 and it also got an error..

@v3g42
Copy link
v3g42 commented Aug 9, 2023

I was able to solve this by specifying the following in package.json

"resolutions": {
    "graphology": "0.25.4"
  }

Reference to the thread graphology/graphology#489 (comment)

@tunahfishy
Copy link

The latest build is also breaking for me:

Error: Cannot find module '~/node_modules/graphology-layout/circular' imported from ~/node_modules/reagraph/dist/index.js
Did you mean to import graphology-layout/circular.js?

amcdnl added a commit that referenced this issue Aug 14, 2023
@amcdnl
Copy link
Member
amcdnl commented Aug 14, 2023

Give 4.12.1 a shot please

@tunahfishy
Copy link
tunahfishy commented Aug 15, 2023 via email

@amcdnl amcdnl added the bug Something isn't working label Aug 22, 2023
@theotanase
Copy link
theotanase commented Sep 5, 2023

I also got the same error.

Node.js 18.16.1
react-scripts: 5.0.1
react: 18.2.0
reagraph: 4.13.0

ERROR in ./node_modules/reagraph/dist/index.js 20:0-50
Module not found: Error: Can't resolve 'graphology-layout/circular' in '....../node_modules/reagraph/dist'
Did you mean 'circular.js'?
BREAKING CHANGE: The request 'graphology-layout/circular' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

@amcdnl amcdnl closed this as completed in 416f77d Sep 18, 2023
@amcdnl
Copy link
Member
amcdnl commented Sep 18, 2023

i think this should be fixed now.

@hverlin
Copy link
Contributor
hverlin commented Sep 27, 2023

@amcdnl I am still getting an error. I think 3 imports need to be fixed:

import random from "graphology-layout/random.js";
import pagerank from "graphology-metrics/centrality/pagerank.js";
import { degreeCentrality } from "graphology-metrics/centrality/degree.js";

https://github.com/search?q=repo%3Areaviz%2Freagraph+%22from+%27graphology-%22&type=code

@amcdnl
Copy link
Member
amcdnl commented Sep 27, 2023

@hverlin - Could you raise a PR for that? I can merge and release it after.

@hverlin
Copy link
Contributor
hverlin commented Sep 28, 2023

@amcdnl I think this should do it: #135

While waiting for this I used the following workaround with a pnpm patch (using pnpm patch reagraph@4.14.0)

package.json

"pnpm": {
    "patchedDependencies": {
      "reagraph@4.14.0": "patches/reagraph@4.14.0.patch"
    }
  }

patches/reagraph@4.14.0.patch

diff --git a/dist/index.js b/dist/index.js
index c44f8558a963fb3516b8f92502fec6509d6f03cf..366022d436d6a4e02ee26b1b7efa3dfb83299115 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -19,9 +19,9 @@ import { treemap, hierarchy, stratify, tree } from "d3-hierarchy";
 import circular from "graphology-layout/circular.js";
 import noverlapLayout from "graphology-layout-noverlap";
 import forceAtlas2Layout from "graphology-layout-forceatlas2";
-import random from "graphology-layout/random";
-import pagerank from "graphology-metrics/centrality/pagerank";
-import { degreeCentrality } from "graphology-metrics/centrality/degree";
+import random from "graphology-layout/random.js";
+import pagerank from "graphology-metrics/centrality/pagerank.js";
+import { degreeCentrality } from "graphology-metrics/centrality/degree.js";
 import { scaleLinear } from "d3-scale";
 import { create } from "zustand";
 import createContext from "zustand/context";

@hverlin
Copy link
Contributor
hverlin commented Sep 28, 2023

Thanks @amcdnl, I can confirm that the latest version (reagraph@4.14.1) is working now

@amcdnl
Copy link
Member
amcdnl commented Sep 28, 2023

Thanks for your contribution too @hverlin !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants
0