Giter VIP home page Giter VIP logo

Comments (7)

theKashey avatar theKashey commented on May 28, 2024

Sounds like a bug in hoist-non-react-statics.

However, I would consider removing this dependency as it's lagging a little behind everchanging requirements.

from loadable-components.

graeme120 avatar graeme120 commented on May 28, 2024

Sounds like a bug in hoist-non-react-statics.

However, I would consider removing this dependency as it's lagging a little behind everchanging requirements.

@theKashey For sure, how do I remove the dependency? And would the plugin work without it? Would I have to substitute it with anything?

from loadable-components.

theKashey avatar theKashey commented on May 28, 2024

The change is required from within loadable.

However can you try debug the issue as there should be a reason why this functionality blows up, something very particular.

from loadable-components.

graeme120 avatar graeme120 commented on May 28, 2024

The change is required from within loadable.

However can you try debug the issue as there should be a reason why this functionality blows up, something very particular.

@theKashey Oh, as in someone would need to commit a change to the loadable repo? And yes, it seems to be the importing of react-p5-wrapper that blows it up, but I cannot see any reason why it would be interpreted as a simple string. Any workarounds you know of that do the same thing as loadable-components? I'm using Gatsby and having a very hard time getting my p5.js files to do SSR. Also quite new to react/node/gatsby

from loadable-components.

theKashey avatar theKashey commented on May 28, 2024

..... because you are expected to do import { ReactP5Wrapper } from "react-p5-wrapper"; - a named, not default export.

just change your code a little

import loadable from "@loadable/component"

const LoadableP5 = loadable(() => import('react-p5-wrapper'), {
  resolveComponent: ({ReactP5Wrapper}) => ReactP5Wrapper,
});

see https://loadable-components.com/docs/api-loadable-component/#optionsresolvecomponent

from loadable-components.

graeme120 avatar graeme120 commented on May 28, 2024

..... because you are expected to do import { ReactP5Wrapper } from "react-p5-wrapper"; - a named, not default export.

just change your code a little

import loadable from "@loadable/component"

const LoadableP5 = loadable(() => import('react-p5-wrapper'), {
  resolveComponent: ({ReactP5Wrapper}) => ReactP5Wrapper,
});

see https://loadable-components.com/docs/api-loadable-component/#optionsresolvecomponent

@theKashey Hm, its loading now, but when I switch pages and return it doesnt reload, the sketch is just stuck as 'loading', does that have anything to do with loadable-components? Also, thank you so much for the advice!

Here are the errors in the console:

GET http://localhost:8000/about/[object%20Object] 404 (Not Found)

head-export-handler-for-browser.js:72 TypeError: o.indexOf is not a function
at eval (p5.min.js:2:1)

from loadable-components.

theKashey avatar theKashey commented on May 28, 2024

Yeah, I am not sure loadable is a problem here, as well not sure it can be a solution - the new problem seems to be originated in P5.

from loadable-components.

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.