Comments (10)
@slack2450 @Ariaspect I believe main.d.ts
is included in the next release, but until then, if you don't want to switch your module resolution to node
, you can add these lines to your tsconfig.json
:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@p5-wrapper/react": [
"node_modules/@p5-wrapper/react",
"node_modules/@p5-wrapper/react/dist/component/main.d.ts"
],
},
}
}
from react.
I will try to look into this one ASAP, I've honestly never seen this error before and I wonder if it's a change in vite itself somehow because the last release had no deployment issues and worked in both vite and next testing.
None of my own projects show this issue also but I will check it because this is a major issue if it's really like this.
I'm on it 🫡
from react.
I can't seem to reproduce this, can you provide your node version, package manager version and any other debug logs you may have available?
from react.
Just experienced this issue as well when trying out the next.js version.
Seems changing "moduleResolution": "node16"
to "moduleResolution": "node"
in tsconfig.json turns off the error.
Related to this perhaps? microsoft/TypeScript#52363
Node: 18.12.0
NPM: 9.8.1
Typescript: 4.3.2
from react.
@jhrtn so you think its a next js issue then? I don't see the issue when I try myself and so I assume this library is working as it should, all it does is take the @p5-wrapper/react library and rewrap it into a next dynamic component anyway, WDYT?
from react.
Closing due to inactivity and the solution provided in #268 (comment).
from react.
I seem to get this issue with "moduleResolution": "bundler",
Which is the default when creating a new Vite React app
It also seems to break typing for p5:
import { P5CanvasInstance, ReactP5Wrapper } from "@p5-wrapper/react";
function sketch(p5: P5CanvasInstance) {
p5.setup = () => p5.createCanvas(600, 400, p5.WEBGL);
p5.draw = () => {
p5.background(250);
};
}
function App() {
return (
<>
<ReactP5Wrapper sketch={sketch} />
</>
)
}
export default App
from react.
This comment on the issue alluded to a fix:
microsoft/TypeScript#52363 (comment)
On this commit:
https://github.com/gxmari007/vite-plugin-eslint/pull/60/files
The fix appears to do with some weird package.json stuff that I really don't care for:
"exports": {
".": {
"import": {
"types": "./dist/component/main.d.ts",
"default": "./dist/component/react.js"
},
"require": {
"types": "./dist/component/main.d.ts",
"default": "./dist/component/react.umd.cjs"
}
}
},
Hopefully this fixes the issue for anyone 😊
from react.
@jamesrweb Please could you take a look at this and see if it's worth including these changes?
from react.
@jamesrweb Please could you take a look at this and see if it's worth including these changes?
@slack2450 Would you like to create a PR for a suggested solution that you have in mind? Happy to review!
If not, I'll check myself as soon as I can but I believe this is a TS / Node / Bundler issue and not a project one AFAICS. Still, if it can help then I'm open to changes so long as they don't break other compilation paths. 😊
from react.
Related Issues (20)
- ReactP5Wrapper has additional pixels in height HOT 3
- Duplicate canvas when running in vite dev HOT 5
- TypeError: p5.loadSound is not a function HOT 4
- P5-wrapper size HOT 5
- Stop rerender of p5 component when redux variables update HOT 3
- Latest commits not in the npm registry HOT 5
- Issue building with Vite 5 HOT 16
- npm ERR! Usage Error: This project is configured to use npm HOT 2
- windowResized() not firing HOT 4
- Error in nextjs HOT 7
- Change p5 dependency version to minimum 1.4.1 HOT 9
- Examples directory doesn't exist, link broken on README HOT 3
- Module parse failed: Identifier 'XX' has already been declared (7762:41) HOT 3
- Is this package supported in React Native? HOT 1
- How to access custom props using abstracted updateWithProps
- Custom updaters as props for use in abstracted methods
- Missing typings for `ReactP5WrapperGuard` in 5.0.0-rc.0 HOT 2
- npm package for version 4.4.1 is empty HOT 3
- It creates new canvas once state is changed HOT 3
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 react.