Comments (6)
I had this in Sapper. Here's how I fixed it:
- Remove both p5 and p5-svelte.
- Install both p5 and p5-svelte but with
-D
this time. - Make some changes in the example code:
//import P5 from 'p5-svelte';
import { onMount } from "svelte";
let P5;
onMount(async () => {
const module = await import("p5-svelte");
P5 = module.default;
});
and
<!-- <P5 {sketch} /> -->
<svelte:component this={P5} {sketch} />
from p5-svelte.
I had this in Sapper. Here's how I fixed it:
- Remove both p5 and p5-svelte.
- Install both p5 and p5-svelte but with
-D
this time.- Make some changes in the example code:
//import P5 from 'p5-svelte'; import { onMount } from "svelte"; let P5; onMount(async () => { const module = await import("p5-svelte"); P5 = module.default; });
and
<!-- <P5 {sketch} /> --> <svelte:component this={P5} {sketch} />
Wow good(clever) work-around :)
from p5-svelte.
@dogfuntom Thanks! I just updated the documentation!
from p5-svelte.
@rawoke083 when I'm following the example in a mac environment, npm install p5-svelte
installs p5 as a peer dependency and this error doesn't occur.
Yet trying the same on Code Sandbox, the peer dependencies aren't being respected for some reason, so adding p5 as a dependency resolves the error: https://codesandbox.io/s/p5-svelte-demo-zvlcm?file=/App.svelte
Perhaps that's the case here - have you tried npm install p5 -D
?
from p5-svelte.
Perhaps that's the case here - have you tried npm install p5 -D?
Nah still getting same error... weird :(
from p5-svelte.
Are you installing to a fresh svelte project using the official template?
Also what environment are you running? Unfortunately, I've been unable to reproduce this issue
from p5-svelte.
Related Issues (20)
- Docs site shows incorrect import statement in examples
- Improve doc site readability
- `init` event in docs typo - should be `instance`
- P5 component prop `project` just gets overwritten on instance init HOT 1
- Add docs example with p5.SVG HOT 1
- TypeScript: p5 re-exported as a type narrows the original aliases
- Native p5 classes (like p5.Vector) are undefined HOT 1
- missing native mouse function for canvas HOT 1
- Support dynamic resizing of the p5 figure HOT 1
- How to use the preload function?
- Cannot access p5's Vector HOT 4
- Error: Invalid value "iife" for option "output.format" HOT 5
- Memory leak when leaving the canvas page HOT 3
- Support for SvelteKit, better abstractions for Sapper HOT 2
- Decrease bundle size HOT 1
- Typescript: Uncaught ReferenceError: p5 is not defined HOT 2
- The requested module '{p5 module}' does not provide an export named 'default' HOT 3
- p5.loadSound is not defined. HOT 5
- Best practice to import a P5.js library HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from p5-svelte.