parse-community / parse-server

Parse Server for Node.js / Express
https://parseplatform.org
Apache License 2.0
20.88k stars 4.78k forks source link

Cannot use import statement outside a module #8223

Open kumardennis opened 2 years ago

kumardennis commented 2 years ago

New Issue Checklist

Issue Description

When running cmd : parse-server --appId APPLICATION_ID --clientKey CLIENT_KEY --masterKey MASTER_KEY --databaseURI mongodb://localhost/test I get error as mentioned in the title

Steps to reproduce

Run parse-server --appId APPLICATION_ID --clientKey CLIENT_KEY --masterKey MASTER_KEY --databaseURI mongodb://localhost/test and use es6(import/export)

Actual Outcome

Getting error `import { CreateUserRequestModel } from "models/users/UserModels"; ^^^^^^

SyntaxError: Cannot use import statement outside a module at compileFunction () at Object.compileFunction (node:vm:352:18) at wrapSafe (node:internal/modules/cjs/loader:1033:15) at Module._compile (node:internal/modules/cjs/loader:1069:27) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18)`

Expected Outcome

Should compile

Environment

4.5.0

Server

Database

Client

Logs

warn: DeprecationWarning: The Parse Server option 'directAccess' default will change to 'true' in a future version. Additionally, the environment variable 'PARSE_SERVER_ENABLE_EXPERIMENTAL_DIRECT_ACCESS' will be deprecated and renamed to 'PARSE_SERVER_DIRECT_ACCESS' in a future version; it is currently possible to use either one. warn: DeprecationWarning: The Parse Server option 'enforcePrivateUsers' default will change to 'true' in a future version. C:\source\teach_and_learn_teacher\Teach_And_Learn_B4A_Cloud_Code\cloud\controllers\teachersControllers\createUserTeacher.ts:1 import { CreateUserRequestModel } from "models/users/UserModels"; ^^^^^^

SyntaxError: Cannot use import statement outside a module at compileFunction () at Object.compileFunction (node:vm:352:18) at wrapSafe (node:internal/modules/cjs/loader:1033:15) at Module._compile (node:internal/modules/cjs/loader:1069:27) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (C:\source\teach_and_learn_teacher\Teach_And_Learn_B4A_Cloud_Code\cloud\main.ts:2:1)

parse-github-assistant[bot] commented 2 years ago

Thanks for opening this issue!

Hriishikeshh commented 2 days ago

hey i would like to work on this assign it to me if suited @mtrezza

mtrezza commented 1 day ago

@Hriishikeshh We do not assign PRs, just feel free to pick up issues and comment that you're working on it; make sure to check whether there are any existing PRs to coordinate with / collaborate on.