jamesleesaunders / d3-x3d

3D Data Driven Charting Library with D3 and X3D
https://jamesleesaunders.github.io/d3-x3d/
GNU General Public License v2.0
108 stars 22 forks source link

Issue causing failing compilation in react #242

Open andy1uu opened 1 year ago

andy1uu commented 1 year ago

Describe the bug Hello I keep getting this message when i try to use this in react:

Failed to compile.

SyntaxError: /Users/andyluu/repo/3d-data/d3-x3d/node_modules/d3-x3d/index.js: Support for the experimental syntax 'importAttributes' isn't currently enabled (13:55): 11 | const copyright = Copyright (C) ${year} ${author}; 12 |

13 | import {default as packageJson} from "./package.json" assert { type: "json" }; | ^ 14 | const version = packageJson.version; 15 | const license = packageJson.license; 16 |

Add @babel/plugin-syntax-import-attributes (https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-attributes) to the 'plugins' section of your Babel config to enable parsing. at parser.next () at normalizeFile.next () at run.next () at transform.next () ERROR in ./node_modules/d3-x3d/index.js Module build failed (from ./node_modules/babel-loader/lib/index.js): SyntaxError: /Users/andyluu/repo/3d-data/d3-x3d/node_modules/d3-x3d/index.js: Support for the experimental syntax 'importAttributes' isn't currently enabled (13:55):

11 | const copyright = Copyright (C) ${year} ${author}; 12 |

13 | import {default as packageJson} from "./package.json" assert { type: "json" }; | ^ 14 | const version = packageJson.version; 15 | const license = packageJson.license; 16 |

To Reproduce Steps to reproduce the behavior: Create a React App and then install this module and try to require it somewhere in the app.js file.

Expected behavior A clear and concise description of what you expected to happen.

jamesleesaunders commented 1 year ago

Thanks for the feedback and reporting this issue. I will try and look into this alto see if I can recreate/fix. All the best, Jim