Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Typescript and build issues #16

Closed
pixelass opened this issue Mar 16, 2022 · 1 comment
Closed

Typescript and build issues #16

pixelass opened this issue Mar 16, 2022 · 1 comment

Comments

@pixelass
Copy link
Contributor

👋 Hello my friends. We are testing lamina, which looks amazing.

Sadly we are having several issues:

Typings:

Argument of type '{ color: string; shading: string; transmission: number; layers: Depth[]; }' is not assignable to parameter of type '(LayerMaterialParameters & AllMaterialParams) | undefined'.
  Object literal may only specify known properties, and 'shading' does not exist in type 'LayerMaterialParameters & AllMaterialParams'.

via

const material = new LayerMaterial({
	color: "#f00",
	shading: "physical", // <-- Typing does not match @types/three
	transmission: 1,
	/* ...*/
})

Screenshot 2022-03-16 at 07 53 53

Build fails: (using next.js on Vercel)

During development everything works. The issue occurs when running next build

> Build error occurred
--
07:08:40.409 | TypeError: THREE.MathUtils.generateUUID(...).replaceAll is not a function
07:08:40.409 | at new Abstract (/vercel/path0/node_modules/lamina/vanilla.cjs.js:124:48)
07:08:40.410 | at new Depth (/vercel/path0/node_modules/lamina/vanilla.cjs.js:372:5)
07:08:40.410 | at /vercel/path0/.next/server/pages/poop.js:53:12 {
07:08:40.410 | type: 'TypeError'
07:08:40.410 | }

Screenshot 2022-03-16 at 07 54 44

Reproduction:

Sadly our sandbox repository is currently private so hopefully the Codesandbox helps.

https://codesandbox.io/s/fast-violet-3ikixi?file=/src/App.tsx:315-379

Versions:

{
  "lamina": "^1.1.3",
   "three": "^0.138.3",
  "@react-three/fiber": "^7.0.26"
}

Help is highly appreciated.
If you need a better example, we can create a full reproduction of our setup (it's really just wrapped in a basic next.js page).
Our original example uses Suspense which does not change the behavior and is not required for this example to run.

@FarazzShaikh
Copy link
Member

FarazzShaikh commented Mar 16, 2022

Fixed the build error! upgrade to 1.1.4. Sorry bout that.

The other issue is a typo in the readme, shading should be lighting 😅.

Fixed sandbox: https://codesandbox.io/s/wizardly-shaw-4hp20d?file=/src/App.tsx:316-382

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants