DEV Community

Rob Chain
Rob Chain

Posted on

Strange error after build for PROD vite with laravel, vue3 and inertia

Hi there, I am struggling with this issue for a couple of days already, I only get this error when I build for production, local environment works fine.
This is the file generated by the build
https://justpaste.it/98pyw
And this is the piece of code that fails:

if (this instanceof a3) {
        return Reflect.construct(f2, arguments, this.constructor);
      }`
Enter fullscreen mode Exit fullscreen mode

The error

app-CQaiJHst.js:9445 Uncaught TypeError: Function has non-object prototype 'undefined' in instanceof check
    at [Symbol.hasInstance] (<anonymous>)
    at Function.a3 (app-CQaiJHst.js:9445:16)
    at app-CQaiJHst.js:9788:21
Enter fullscreen mode Exit fullscreen mode

The vite.config file (for debugging purpose, I switched off minimized files)

https://playcode.io/2017607

Note: paste the vite.config file here was a pain, that's why I add an external link with the code.

Node version in prod and local environments (remote server and local v16.17.0 I already tried to upgrade and downgrade the node versions but I always got the same error/result)

I also remove the node_modules many times reinstalling them, but nothing changes. I think the error is caused by vite when builds for production, but I have not clue how to fix it.

Any clue?
Thanks

Top comments (1)

Collapse
 
r0bschuh profile image
Rob Chain

Hi there, finally I found a solution , I posted here:
stackoverflow.com/questions/790090...