Skip to content
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

JSONDigger is not defined #79

Closed
javier-godoy opened this issue Jun 27, 2024 · 4 comments
Closed

JSONDigger is not defined #79

javier-godoy opened this issue Jun 27, 2024 · 4 comments
Assignees

Comments

@javier-godoy
Copy link
Member

Describe the bug

fc-orgchart-styles-DN-_P1bn.js:16 Uncaught (in promise) ReferenceError: JSONDigger is not defined
    at B.dropHandler (fc-orgchart-styles-DN-_P1bn.js:16:40109)
    at HTMLDivElement.dispatch (fc-orgchart-styles-DN-_P1bn.js:13:43325)
    at J.handle (fc-orgchart-styles-DN-_P1bn.js:13:41294)

Expected behavior

No response

Minimal reproducible example

  1. Go to https://addonsv24.flowingcode.com/orgchart/drag-and-drop
  2. Attempt to drag an item
  3. Observe that an error is logged in the browser console

Add-on Version

5.0.1

Vaadin Version

24.4.1

Additional information

No response

@github-project-automation github-project-automation bot moved this to Inbox (needs triage) in Flowing Code Addons Jun 27, 2024
@paodb paodb self-assigned this Jul 2, 2024
@paodb paodb moved this from Inbox (needs triage) to To Do in Flowing Code Addons Jul 2, 2024
@paodb
Copy link
Member

paodb commented Jul 8, 2024

JSONDigger is a dependency that was added in the base library since version 3.4.0. I tried to add this dependency in the add-on using @NpmPackage(value = "json-digger", version = "2.0.2") and @JsModule("json-digger/dist/json-digger.js") but that's not enough as the import of JSONDigger object is missing in the core component. Tried adding it in the fc-orgchart.js file but a lot of webpack errors appears when trying to run the demo app in vaadin 14, like
image If I run profile v24 then I get a different error
image

One other aproach I tried was to donwgrade the library dependency to one that is not using JsonDigger, like 3.2.0, It works but some styling break on the drag/drog example that would need fixing.

@paodb
Copy link
Member

paodb commented Sep 11, 2024

Found this related issue on the original library.

@jxmai
Copy link

jxmai commented Oct 1, 2024

@paodb It seems we're facing a similar issue due to an upstream dependency. The JSON Digger library was added as a required dependency, but it brought in webpack-related dependencies along with it.

You can see the source here: https://raw.githubusercontent.com/dabeng/json-digger/refs/heads/master/dist/json-digger.js (The JS file is quite large 😅).

Not sure if your situation is better, but for us, we're not using webpack at all, and this has become a blocker for upgrading.

@paodb
Copy link
Member

paodb commented Feb 12, 2025

Did some more testing, but no luck yet. There's a newer version, 5.0.0 but issue with JSONDigger dependency still exists. After that first attempt failed, I tried overriding the source code of the version in use (3.7.0) by adding it as add-on resource but, adding import for the JSONDigger library breaks and a lot of webpack errors appear. As mentioned on the previous comment, this library has webpack dependencies that make everything fails. I get a lot of errors similar to this one:

[webpack] ERROR dev-webpack - �[91mModule not found: Error: Can't resolve 'module' in 'C:\Development\repositorios\flowing-add-ons\OrgChartAddon\node_modules\webpack\lib\node'�[0m
[webpack] ERROR dev-webpack - �[91m @ ../node_modules/webpack/lib/node/NodeTargetPlugin.js 11:1-18�[0m
[webpack] ERROR dev-webpack - �[91m @ ../node_modules/webpack/lib/node sync ^\.\/.*$�[0m
[webpack] ERROR dev-webpack - �[91m @ ../node_modules/webpack/lib/node/NodeMainTemplate.runtime.js�[0m
[webpack] ERROR dev-webpack - �[91m @ ../node_modules/webpack/lib/node/NodeMainTemplatePlugin.js�[0m
[webpack] ERROR dev-webpack - �[91m @ ../node_modules/webpack/lib/node/NodeTemplatePlugin.js�[0m
[webpack] ERROR dev-webpack - �[91m @ ../node_modules/webpack/lib/webpack.js�[0m
[webpack] ERROR dev-webpack - �[91m @ ../node_modules/@vaadin/flow-frontend/orgchart/dist/js/jquery.orgchart.js�[0m
[webpack] ERROR dev-webpack - �[91m @ ../target/frontend/generated-flow-imports.js

Also tried to import the webpack dependency but didn't work either.

Not sure how to move forward with this component. Should we downgrade the orgchart library version as suggested before?

javier-godoy added a commit that referenced this issue Mar 26, 2025
@paodb paodb closed this as completed in 81e7151 Apr 3, 2025
@github-project-automation github-project-automation bot moved this from To Do to Done in Flowing Code Addons Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants