Giter VIP home page Giter VIP logo

Comments (11)

domoritz avatar domoritz commented on May 26, 2024

Good catch. Can you send a pull request to add it?

from react-vega.

hukka avatar hukka commented on May 26, 2024

Sure, if the manual addition to package.json is the way to handle it. That would be about the only way at the moment I know how to resolve it ;)

from react-vega.

domoritz avatar domoritz commented on May 26, 2024

Hmm, I just checked and saw that React depends on prop types. Not sure how it would be missing if you have react:

prop-types "^15.6.2"
.

Since react is a peer dependency, I don't think we need to add this, do we?

from react-vega.

hukka avatar hukka commented on May 26, 2024

React seems to have it as dev-dependency, and npm install doesn't pull it. My package-lock.json for react:

    "node_modules/react": {
      "version": "17.0.2",
      "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz",
      "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==",
      "dependencies": {
        "loose-envify": "^1.1.0",
        "object-assign": "^4.1.1"
      },
      "engines": {
        "node": ">=0.10.0"
      }
    },

from react-vega.

domoritz avatar domoritz commented on May 26, 2024

Ohh, I see. I still wonder where prop-types is added since it's nowhere in the code. Can you see where it comes from?

from react-vega.

hukka avatar hukka commented on May 26, 2024

I tried looking a bit further, but can't get a handle on it. Nimbus seems very sparsely documented. And the lib/Vega.js has _interopRequireDefault(require("prop-types")) which seems to be some babel internal magic, also not really useful avenue. To add to the insult, the built Vega.js files (esm or lib) don't even use the import/var, though VegaEmbed at least calls to it (in the built version, not in the source). No idea if that means that the imports still do some kind of side effects.

from react-vega.

domoritz avatar domoritz commented on May 26, 2024

I'd be inclined not to add the dependency until we understand the issue.

from react-vega.

aiba avatar aiba commented on May 26, 2024

Also hit this issue. Had to manually add "prop-types" and also "process" and "buffer" as dependencies.

from react-vega.

kristw avatar kristw commented on May 26, 2024

@aiba Seems to caused by babel-plugin-typescript-to-proptypes that add prop-types during transpile time. Let me investigate.

Update 1:

TypeScript may display an error message if an incorrect prop type is passed to the component, but if you are integrating with an external API or using an external library that does not have typings, you can not be 100% sure that you will always get the right data.

That's when PropTypes become useful - they display a warning in the console when unexpected data ends up in your component, making it much easier to debug where exactly an error is.

https://vhudyma-blog.eu/proptypes-in-react-are-they-still-needed/#:~:text=The%20answer%20may%20not%20be,always%20get%20the%20right%20data.

Seems like we should keep it and I can add prop-types to dependencies.

Update 2:
Wonder where process and buffer are from. I don't see them.

from react-vega.

kristw avatar kristw commented on May 26, 2024

Please try [email protected]

from react-vega.

aiba avatar aiba commented on May 26, 2024

With 7.5.1, still getting a missing dep on buffer, but perhaps this is a vega-loader issue?

logs/client-dev.log: The required JS dependency "buffer" is not available, it was required by "node_modules/vega-loader/build/vega-loader.browser.js".
logs/client-dev.log: Dependency Trace:
logs/client-dev.log: 	node_modules/react-vega/lib/index.js
logs/client-dev.log: 	node_modules/react-vega/lib/Vega.js
logs/client-dev.log: 	node_modules/react-vega/lib/utils/updateMultipleDatasetsInView.js
logs/client-dev.log: 	node_modules/react-vega/lib/utils/updateSingleDatasetInView.js
logs/client-dev.log: 	node_modules/vega-embed/build/vega-embed.js
logs/client-dev.log: 	node_modules/vega/build/vega-node.js
logs/client-dev.log: 	node_modules/vega-dataflow/build/vega-dataflow.js
logs/client-dev.log: 	node_modules/vega-loader/build/vega-loader.browser.js

from react-vega.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.