Skip to content

Commit 77103a5

Browse files
committed
revert: refactor: allow ES import for cloud string if package type is module
This reverts commit 0225340.
1 parent 6962bfa commit 77103a5

File tree

4 files changed

+2
-18
lines changed

4 files changed

+2
-18
lines changed

.babelrc

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
["@babel/preset-env", {
88
"targets": {
99
"node": "12"
10-
},
11-
"exclude": ["proposal-dynamic-import"]
10+
}
1211
}]
1312
],
1413
"sourceMaps": "inline"

spec/CloudCode.spec.js

-8
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ describe('Cloud Code', () => {
3939
});
4040
});
4141

42-
it('can load cloud code as a module', async () => {
43-
process.env.npm_package_type = 'module';
44-
await reconfigureServer({ cloud: './spec/cloud/cloudCodeModuleFile.js' });
45-
const result = await Parse.Cloud.run('cloudCodeInFile');
46-
expect(result).toEqual('It is possible to define cloud code in a file.');
47-
delete process.env.npm_package_type;
48-
});
49-
5042
it('can create functions', done => {
5143
Parse.Cloud.define('hello', () => {
5244
return 'Hello world!';

spec/cloud/cloudCodeModuleFile.js

-3
This file was deleted.

src/ParseServer.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,7 @@ class ParseServer {
108108
if (typeof cloud === 'function') {
109109
cloud(Parse);
110110
} else if (typeof cloud === 'string') {
111-
if (process.env.npm_package_type === 'module') {
112-
import(path.resolve(process.cwd(), cloud));
113-
} else {
114-
require(path.resolve(process.cwd(), cloud));
115-
}
111+
require(path.resolve(process.cwd(), cloud));
116112
} else {
117113
throw "argument 'cloud' must either be a string or a function";
118114
}

0 commit comments

Comments
 (0)