diff --git a/.babelrc b/.babelrc index a199154b82..9151969bde 100644 --- a/.babelrc +++ b/.babelrc @@ -7,8 +7,7 @@ ["@babel/preset-env", { "targets": { "node": "12" - }, - "exclude": ["proposal-dynamic-import"] + } }] ], "sourceMaps": "inline" diff --git a/spec/CloudCode.spec.js b/spec/CloudCode.spec.js index 17968c33d7..d5e6113763 100644 --- a/spec/CloudCode.spec.js +++ b/spec/CloudCode.spec.js @@ -39,14 +39,6 @@ describe('Cloud Code', () => { }); }); - it('can load cloud code as a module', async () => { - process.env.npm_package_type = 'module'; - await reconfigureServer({ cloud: './spec/cloud/cloudCodeModuleFile.js' }); - const result = await Parse.Cloud.run('cloudCodeInFile'); - expect(result).toEqual('It is possible to define cloud code in a file.'); - delete process.env.npm_package_type; - }); - it('can create functions', done => { Parse.Cloud.define('hello', () => { return 'Hello world!'; diff --git a/spec/cloud/cloudCodeModuleFile.js b/spec/cloud/cloudCodeModuleFile.js deleted file mode 100644 index a62b4fcc24..0000000000 --- a/spec/cloud/cloudCodeModuleFile.js +++ /dev/null @@ -1,3 +0,0 @@ -Parse.Cloud.define('cloudCodeInFile', () => { - return 'It is possible to define cloud code in a file.'; -}); diff --git a/src/ParseServer.js b/src/ParseServer.js index dc2af9e7be..e6b30d1918 100644 --- a/src/ParseServer.js +++ b/src/ParseServer.js @@ -108,11 +108,7 @@ class ParseServer { if (typeof cloud === 'function') { cloud(Parse); } else if (typeof cloud === 'string') { - if (process.env.npm_package_type === 'module') { - import(path.resolve(process.cwd(), cloud)); - } else { - require(path.resolve(process.cwd(), cloud)); - } + require(path.resolve(process.cwd(), cloud)); } else { throw "argument 'cloud' must either be a string or a function"; }