Md5-related errors after upgrade to NE 5.x

Hey guys,

I’m currently trying to upgrade from 4.16.7 to 5.0.3 but afterwards I get a few of those (all md5-related) which causes the engine failing to load:

md5.js?v=03d92c56:2 Uncaught ReferenceError: require is not defined
    at md5.js?v=03d92c56:2:15
    at md5.js?v=03d92c56:160:3
(anonymous) @ md5.js?v=03d92c56:2
(anonymous) @ md5.js?v=03d92c56:160

With a bit of AI support I found it works again when adding this to my vite.config.js:

optimizeDeps: {
    include: ['md5'],
    exclude: []
}

I do not have this error in a toy project where I tried to reproduce it, only in my full production setup.

Any idea what could be going wrong here?

Hey krizzl0r,

The ReferenceError: require is not defined usually points to a module resolution issue in a browser environment, especially when upgrading. Since adding md5 to optimizeDeps.include in vite.config.js fixed it for your production setup, it suggests Vite isn’t pre-bundling md5 correctly by default in that specific project. Your toy project might have a slightly different dependency tree or configuration that allows Vite to resolve it without the explicit optimizeDeps entry.

To confirm this, can you share the package.json from your production setup? It would help see if there are any unusual dependencies or configurations that might interfere with Vite’s default optimization.

Sources: Needle Engine Skill (85%), Needle Engine Skill (83%), Needle Engine Docs (65%)

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

Hi which framework and vite version are you using in your big project vs the toy project?

(On canary I’ve removed the md5 dependency because of this error but it’s not available yet)

If you’re talking about web frameworks – none. Vite 4.3.9.