jazz-soft/JZZ

TypeError with react-scripts 5.0.0 / webpack v5

SmallHollow opened this issue · 3 comments

I've been successfully using JZZ in a project created with Create React App (CRA). However, I just updated the CRA's react-scripts package that bundles a newer Webpack v5 (previously v4) and now I get this error when trying to initialize the engine:

TypeError: (jzz__WEBPACK_IMPORTED_MODULE_2___namespace_cache || (intermediate value)(intermediate value)) is not a function

As a result, the JZZ engine does not work. I noticed an earlier Webpack issue #50 but this is a different case.

Any ideas how to fix this?

Unfortunately, I don't have much experience with Webpack.
I will try to find the solution, but that may take long time.
Please feel free to debug the issue - I would greatly appreciate this!

Ok, this was easily fixed. I created a brand new project with CRA and JZZ was working without any issues. While comparing the new project with my code the only difference I noticed was the "type": "module" I had in package.json. Removing this declaration entirely fixed the problem! So apparently Webpack v5 is more strict about the type declaration than the previous versions (or something, as I'm not a Webpack expert at all).

Thanks a lot for looking into it!