Hello,
I’m trying to create an API service using JS. I downloaded the project template and started editing it in VS Code.
Everything worked well until I added an external module to the code
'use strict';
import * as Random from "random";
class SampleService2 {
sampleService2Method(name) {
return {"message": Random.float(0, 10)};
}
}
SampleService2.version = '1.0.0';
Backendless.ServerCode.addService(SampleService2);
If I remove the import statement all works well, otherwise, while deploying via npm run deploy I get this error:
19:07:36.736 Errors (1):
19:07:36.745 Cannot use import statement outside a module (services\bcd\SampleService2.js)
19:07:36.746 Error: Please resolve Model Errors before deploying to production.
Can anyone help me? Thank you in advice