InteropIO / FDC3

Open standards for the financial desktop.
https://fdc3.finos.org
Other
2 stars 1 forks source link

Bump react-scripts to v5 #43

Closed julianna-ciq closed 1 year ago

julianna-ciq commented 2 years ago

react-scripts v5 uses webpack v5. As part of webpack v5's breaking changes, they no long automatically add nodejs polyfills. json-schema-ref-parser uses some nodejs built-in libraries like process, http, url, utils, etc.

For everything besides process, we can do this weird magical thing:

devDependencies: {
  util: "npm@util@0.12.4"
}

and magically webpack packs those libraries, I guess?

After updating the devDependencies, the package could build, but there were console errors on the site page. There were runtime errors because window.process was undefined. I added a quick hack to the index.html to force that global variable. (We can assume this hack is permanent, because I can't imagine webpack v5 or react v5 will budge on the polyfill thing, and I doubt json-schema-ref-parser will have enough participant interest to fix it.)

I did not test this within a Desktop Agent. This will require testing using both npm run start and npm run build, to make sure that the packaged polyfills (including the hack) didn't break anything. Especially anything the ref-parser touches.