We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 87c5590 commit ae9869eCopy full SHA for ae9869e
src/ParseServer.js
@@ -103,14 +103,10 @@ class ParseServer {
103
if (typeof cloud === 'function') {
104
cloud(Parse);
105
} else if (typeof cloud === 'string') {
106
- try {
+ if (process.env.npm_package_type === 'module') {
107
+ import(path.resolve(process.cwd(), cloud));
108
+ } else {
109
require(path.resolve(process.cwd(), cloud));
- } catch (e) {
- if (e.code === 'ERR_REQUIRE_ESM') {
110
- import(path.resolve(process.cwd(), cloud));
111
- } else {
112
- throw e;
113
- }
114
}
115
} else {
116
throw "argument 'cloud' must either be a string or a function";
0 commit comments