Issue when upgrading Parse Server

Iā€™m running into problem trying to upgrade to new versions of Parse Server. If I run Parse Server 7.1.0, everything works correctly. However, after upgrading to either 7.2.0 or 7.3.0, I get this error:

require() of ES Module /node_modules/@parse/push-adapter/src/index.js from /index.js not supported. Instead change the require of /node_modules/@parse/push-adapter/src/index.js in /index.js to a dynamic import() which is available in all CommonJS modules.

If I add ā€œtypeā€: ā€œmoduleā€ to my package.json file, I should be able to successfully import the push-adapter, but that makes it so that ā€œrequireā€ no longer works, and thatā€™s used extensively throughout the project. The Git page for the push adapter says this:

// For CommonJS replace the import statemtent above with the following line:
// const ParsePushAdapter = require(ā€˜@parse/push-adapterā€™).default;

And this is how I have been instantiating the push adapter for several years. Now Iā€™m no longer able to do so. Is there something simply Iā€™m missing here? Is there a way I can get the push adapter imported using ā€œrequireā€ when running Parse Server 7.3.0?

Iā€™m coming back to this issue after a few months, because the error is still being thrown when attempting to upgrade to parse-server > 7.1.0. Does anyone know why ā€œrequire(ā€˜@parse/push-adapterā€™).defaultā€ isnā€™t working in my environment? To reiterate, if I downgrade to parse-server 7.1, the code Iā€™ve been working with for years that imports the push adapter with the ā€œrequireā€ statement" woks as it should. The error only happens when I attempt to upgrade parse-server. Any help would be much appreciated.

After more searching and troubleshooting, I believe I have the solution. First, the right, or proper, solution is to update all my project to ESM logic so as to use ā€œimportā€ for all of my included modules in all scripts. That option isnā€™t possible for me right now since it would take quite a lot of time and testing to make sure there are no problems throughout the Cloud Code. I will do this eventually, but not now.

The workaround Iā€™ve found is to use an async IIFE to wrap all my config code in our index.js file. Inside the IIFE, I can then use this expression to import the push adapter:

const { default: PushAdapter } = await import('@parse/push-adapter')

If there is something wrong with this approach, please let me know. Thank you everyone!