-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Move to ECMAScript ES Module Import statements from require #9316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for opening this issue!
|
You could "import" (not "require") Parse Server like so:
If you are referring to the Cloud Code file, then this may be a duplicate of #7559? If you mean something else, then please provide more details and example code to explain the issue. |
I'm talking of using import and export statements inside cloud code
27 sept. 2024 03:43:14 Manuel ***@***.***>:
…
Could you provide more details, and example code, to explain the issue? You could "import" (not "require") Parse Server like so:
*import { ParseServer } from 'parse-server';
*
—
Reply to this email directly, view it on GitHub[#9316 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AG346YF4XN7ZOD5IF3EZO6DZYSZ3DAVCNFSM6AAAAABO5JUWM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZYGI2DCMRRGU].
You are receiving this because you authored the thread.
[Image de pistage][https://github.com/notifications/beacon/AG346YAYBXD3JTUAAEJODPLZYSZ3DA5CNFSM6AAAAABO5JUWM6WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUNYEKL6.gif]
|
Is this then a duplicate of #7559? A workaround would be to create a file
The file imports a ESM to make it available via CommonJS. This doesn't require any code rewriting. |
This works perfectly! |
Closing as duplicate of #7559 |
New Feature / Enhancement Checklist
Current Limitation
Using require is the old way of coding, most of my code needs to be converted to this crappy syntax when moving to cloud code
Feature / Enhancement Description
Use import instead of require in the whole project
Example Use Case
Not having to rewrite code to an old way of doing
Alternatives / Workarounds
Thanks to @mtrezza here is a workaround:
Creating a main.cjs file in the cloud folder and pointing to it in the Parse Server Config
3rd Party References
Litteraly every single big node based project
Would also recommend using hono and deno to get a massive performance boost
The text was updated successfully, but these errors were encountered: