Vite error in dev server after upgrading

Upgraded to 5.0.3. Old package.json:

{
“name”: “my-needle-engine-project”,
“version”: “1.0.0”,
“type” : “module”,
“scripts”: {
“start”: “vite --host”,
“build:dev”: “vite build”,
“build:production”: “vite build – --production”
},
“dependencies”: {
“@needle-tools/engine”: “4.16.2”,
“three”: “npm:@needle-tools/three@0.169.19”,
“@needle-tools/samples-scripts”: “file:./../Library/PackageCache/com.needle.engine-samples@84003f6bd6b6/Runtime/_Shared/SampleScripts~”,
“needle.samples.scrollytelling”: “file:./../Library/PackageCache/com.needle.engine-samples@84003f6bd6b6/Runtime/Scrollytelling/Needle.Samples.Scrollytelling~”,
“@needle-tools/needle-sample-videoplayer”: “file:./../Library/PackageCache/com.needle.engine-samples@84003f6bd6b6/Runtime/VideoPlayer/Scripts/Needle.Sample.VideoPlayer~”
},
“devDependencies”: {
“@needle-tools/helper”: “2.0.0-next.faf57e6”,
“@types/three”: “0.169.0”,
“@vitejs/plugin-basic-ssl”: “^1.0.1”,
“typescript”: “^5.0.4”,
“vite”: “<= 4.3.9”,
“vite-plugin-compression”: “^0.5.1”
}
}

New package.json:

{
“name”: “my-needle-engine-project”,
“version”: “1.0.0”,
“type”: “module”,
“scripts”: {
“start”: “vite --host”,
“build:dev”: “vite build”,
“build:production”: “vite build – --production”
},
“dependencies”: {
“@needle-tools/engine”: “5.0.3”,
“@needle-tools/needle-sample-videoplayer”: “file:./../Library/PackageCache/com.needle.engine-samples@84003f6bd6b6/Runtime/VideoPlayer/Scripts/Needle.Sample.VideoPlayer~”,
“@needle-tools/samples-scripts”: “file:./../Library/PackageCache/com.needle.engine-samples@84003f6bd6b6/Runtime/_Shared/SampleScripts~”,
“needle.samples.scrollytelling”: “file:./../Library/PackageCache/com.needle.engine-samples@84003f6bd6b6/Runtime/Scrollytelling/Needle.Samples.Scrollytelling~”,
“three”: “npm:@needle-tools/three@0.169.19”
},
“devDependencies”: {
“@needle-tools/helper”: “2.0.0”,
“@types/three”: “0.169.0”,
“@vitejs/plugin-basic-ssl”: “^1.0.1”,
“typescript”: “^5.0.4”,
“vite”: “<= 4.3.9”,
“vite-plugin-compression”: “^0.5.1”
}
}

Two symptoms of the bug:

  1. This error in the JS console:

installHook.js:1 Error creating clip

  1. Qt {__context: Ye, __name: ‘VideoPlayer’, gameObject: Ht, guid: ‘1364795212’, sourceId: ‘./assets/RivereMain.glb’, 
}

TypeError: Failed to construct ‘URL’: 1 argument required, but only 0 present. at p_ (needle-engine.extras
1d2ad6b.js:166:2006) at l (needle-engine.extras
d2ad6b.js:151:18403) at f_ (needle-engine.extras
d2ad6b.js:151:18775) at C3 (needle-engine.extras
1d2ad6b.js:1481:228) at needle-engine.extras
2ad6b.js:1476:11346 at Mm (needle-engine.extras
d2ad6b.js:799:15774) at Ye.internalOnCreate (needle-engine.extras
1d2ad6b.js:783:1862) at async Ye.create (needle-engine.extras
d2ad6b.js:773:10217) at async HTMLElement.onLoad (needle-engine.extras
1d2ad6b.js:1646:906)

overrideMethod @ installHook.js:1
p_ @ needle-engine.extras.41d2ad6b.js:166
l @ needle-engine.extras.41d2ad6b.js:151
f_ @ needle-engine.extras.41d2ad6b.js:151
C3 @ needle-engine.extras.41d2ad6b.js:1481
(anonymous) @ needle-engine.extras.41d2ad6b.js:1476
Mm @ needle-engine.extras.41d2ad6b.js:799
internalOnCreate @ needle-engine.extras.41d2ad6b.js:783
setTimeout
xe @ three@0.169.19.js:3847
setTimeout
xe @ three@0.169.19.js:3847
(anonymous) @ three@0.169.19.js:3847
MR.compileAsync @ three@0.169.19.js:3847
M3 @ needle-engine.extras.41d2ad6b.js:1484
xu @ needle-engine.extras.41d2ad6b.js:1484
await in xu
(anonymous) @ needle-engine.extras.41d2ad6b.js:1483
(anonymous) @ three-examples@0.169.19.js:1
(anonymous) @ three-examples@0.169.19.js:1
  1. As soon as I scroll, the main animation just starts auto playing and does not respond to scrolling

Your package.json specifies "vite": "<= 4.3.9" in devDependencies. The issue might be related to an incompatible Vite version after upgrading Needle Engine. Try removing the version constraint for Vite ("vite": "<= 4.3.9") and running npm install again. This will allow npm to install a compatible Vite version for Needle Engine 5.0.3. If that doesn’t work, send a bug report via the Unity menu “Needle Engine/Report a Bug”. (10)

Sources: Needle Engine Skill (99%), Needle Engine Skill (95%), Needle Engine Docs (75%), Needle Engine Docs (75%)

1 replies left - Become PRO for more replies.
Reply to this post directly if you need further help (bottom right button)

Hi,

Have you tried to restart you local web server after the upgrade? Make sure to run install in the local packages too / they’re updated as well.

TypeError: Failed to construct ‘URL’: 1 argument required, but only 0 present. this is a error from Vite, could be caused by the dev server still running during the update, it’s hard to say. Could you share the sourcecode for needle-engine.extras
d2ad6b.js:151:18403) at f_ (needle-engine.extras
d2ad6b.js:151:18775 as well?

So when I run it from the dev webserver, these errors I’m describing go away. The errors are thrown off by a production build. I am testing it locally, using nginx running on my Mac (for what it’s worth, I also use Herd). I’m pointing nginx at the dist folder as the root.

At this point, I have updated everything I know to do:

Needle 5.0.3
All dependencies reinstalled to allow NPM to align versions
So now, also: Vite 8.0.8

I also updated the Needle Engine Samples project to 1.4.5.

So when I run it from the dev webserver, these errors I’m describing go away. The errors are thrown off by a production build. I am testing it locally, using nginx running on my Mac (for what it’s worth, I also use Herd). I’m pointing nginx at the dist folder as the root.

At this point, I have updated everything I know to do:

Needle 5.0.3
All dependencies reinstalled to allow NPM to align versions
So now, also: Vite 8.0.8

I also updated the Needle Engine Samples project to 1.4.5.


Forgot to include requested source code:

The source file is not what your error is printing above. needle-engine.extras
d2ad6b.js:151:18403) at f_ (needle-engine.extras
d2ad6b.js:151:18775

You sent the original typescript file and not the Vite bundle output (note the log includes a hash + line and column information)

I haven’t tried Vite 8.0.8 yet (our template is using 8.0.3) in case it makes a difference.

Oh! I’m sorry, my mistake.

Please note, latest version of build has different hashsums, so here is the console error message again:

installHook.js:1 Error creating clip
X {__context: e, __name: ‘VideoPlayer’, gameObject: Ji, guid: ‘1364795212’, sourceId: ‘./assets/RivereMain.glb’, 
}
TypeError: Failed to construct ‘URL’: 1 argument required, but only 0 present.
at il (needle-engine-ui.BNxZ9JGV.js:117:20084)
at s (needle-engine-ui.BNxZ9JGV.js:117:16412)
at Qc (needle-engine-ui.BNxZ9JGV.js:117:16266)
at rd (needle-engine.extras
btahoH.js:210:14372)
at needle-engine.extras
btahoH.js:210:12183
at Ds (needle-engine-ui.BNxZ9JGV.js:113:4791)
at e.internalOnCreate (needle-engine-ui.BNxZ9JGV.js:728:5438)
at async e.create (needle-engine-ui.BNxZ9JGV.js:726:8470)
at async HTMLElement.onLoad (needle-engine.extras.DjbtahoH.js:129:869)
overrideMethod @ installHook.js:1
il @ needle-engine-ui.BNxZ9JGV.js:117
s @ needle-engine-ui.BNxZ9JGV.js:117
Qc @ needle-engine-ui.BNxZ9JGV.js:117
rd @ needle-engine.extras.DjbtahoH.js:210
(anonymous) @ needle-engine.extras.DjbtahoH.js:210
Ds @ needle-engine-ui.BNxZ9JGV.js:113
internalOnCreate @ needle-engine-ui.BNxZ9JGV.js:728

And because it seems relevant, these failures are definitely impacting the video textures we used in a few places in the Scene. So we are absolutely trying to get this VideoPlayer thing working, but to the best of my knowledge, we did not write any custom code here.

Here are the files.

Hi Marcel! Any insight here?