Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(r158 nodes) Webpack error in ModelNode #27076

Closed
njarraud opened this issue Oct 28, 2023 · 13 comments · Fixed by #27189
Closed

(r158 nodes) Webpack error in ModelNode #27076

njarraud opened this issue Oct 28, 2023 · 13 comments · Fixed by #27189

Comments

@njarraud
Copy link
Contributor

Description

I tried to upgrade from r155 to r158 to check the latest improvements of the node system however webpack throws an error on start up. (I use Next.js)

Capture d’écran 2023-10-28 à 13 32 26

It seems to be related to the temp function called in accessors/ModelNode.js

export const modelViewMatrix = nodeImmutable( ModelNode, ModelNode.VIEW_MATRIX ).temp( 'ModelViewMatrix' );

Reproduction steps

  1. Use three r158 in a project that uses webpack

Code

Live example

None

Screenshots

No response

Version

r158

Device

No response

Browser

No response

OS

No response

@CodyJasonBennett
Copy link
Contributor

Does this persist if you remove "sideEffects": false from three's package.json? That tells Webpack it can skip entire directories if unreferenced in code, but Nodes specifically are quite effectful to populate these methods and perhaps should be globbed with this property.

@Mugen87 Mugen87 added the Nodes label Oct 30, 2023
@TobiasNoell
Copy link

We are having the same problem in an Angular app when going from 157 to 158

Uncaught TypeError: (0 , _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)(...).temp is not a function
    at 1632 (ModelNode.js:26:82)
    at __webpack_require__ (bootstrap:19:1)
    at 50116 (MorphNode.js:70:1)
    at __webpack_require__ (bootstrap:19:1)
    at 22487 (luminance-node.ts:26:2)
    at __webpack_require__ (bootstrap:19:1)
    at 37149 (material-exporter.ts:288:2)
    at __webpack_require__ (bootstrap:19:1)
    at 33655 (orbit-controls.ts:742:2)
    at __webpack_require__ (bootstrap:19:1)

@TobiasNoell
Copy link

Does this persist if you remove "sideEffects": false from three's package.json? That tells Webpack it can skip entire directories if unreferenced in code, but Nodes specifically are quite effectful to populate these methods and perhaps should be globbed with this property.

Removing "sideEffects": false from three's package.json does not seem to help

@Mugen87
Copy link
Collaborator

Mugen87 commented Oct 31, 2023

Related PR #26881.

@Mugen87
Copy link
Collaborator

Mugen87 commented Oct 31, 2023

What version of Webpack are you using?

@TobiasNoell
Copy link

What version of Webpack are you using?

webpack@5.76.1

@njarraud
Copy link
Contributor Author

njarraud commented Nov 1, 2023

Webpack 5.86

@mlt131220
Copy link

What version of Webpack are you using?

vite/4.4.7 win32-x64 node-v16.18.0

@TobiasNoell
Copy link

Does this persist if you remove "sideEffects": false from three's package.json? That tells Webpack it can skip entire directories if unreferenced in code, but Nodes specifically are quite effectful to populate these methods and perhaps should be globbed with this property.

Removing "sideEffects": false from three's package.json does not seem to help

@CodyJasonBennett: Actually, I was wrong about it (it was still using a cached version in my test before):
Removing "sideEffects": false from package.json indeed seems to help!

@Mugen87
Copy link
Collaborator

Mugen87 commented Nov 6, 2023

Could one of the Webpack users also report this issue to the Webpack repository?

It seems it is not clear yet why the build-tool is failing in ModelNode. The code itself works but for some reasons Webpack doesn't understand it.

@eytienne
Copy link

I added the following Webpack rule to address this issue:

{
	test: /node_modules\/three\/examples\/jsm\/nodes\/.*\.(ts|js)$/,
	use: {
		loader: 'babel-loader',
	},
	sideEffects: true
},

@Hoodgail
Copy link
Contributor

I'm having the same issue with vite

@seancheno
Copy link

We are experiencing this issue as well. Spent about 2 days now trying to get past it. We are using ts and vite. When I import MeshPhysicalNodeMaterial from "three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial"; we get the error index.js:5273 Uncaught (in promise) TypeError: We(...).label is not a function for const iu = We(Br, Br.VIEW_MATRIX).label("modelViewMatrix").temp("ModelViewMatrix")

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

Successfully merging a pull request may close this issue.

8 participants