Is posible using typescript in moralis-cli cloud functions

this is my code inside cloud.ts:

import LM from ‘./LM’;

const Moralis = require(‘moralis’);

Moralis.initialize(‘xxx’);

Moralis.serverURL = ‘xx’

Moralis.Cloud.define(“lmAnalisys”, async (request) => {

const result =new LM(request.params.imaginaryPartY, request.params.imaginaryPartX, undefined, 5, undefined, undefined, undefined, undefined, undefined, undefined).fit();



return {

    "dfRealPartX":result.dfRealPartX,

    "dfRealPartY":result.dfRealPartY,          

    }

});

so then in terminal i do:

moralis-admin-cli watch-cloud-folder --moralisApiKey xxx–moralisApiSecret xx–moralisSubdomain sjtdobqz7olf.moralishost.com --autoSave 1 --moralisCloudfolder cloud.ts

  • Listening folder: cloud.ts <---- and stay here for a long time…

this is possible?

my doub is if i can import external libraries and using it?

Someone was able to include external libraries in cloud code, but he did a build with vercel (https://github.com/vercel/ncc) before uploading a single java script file. For now there isn’t a native support for external libraries in cloud code, the plan is to have that support for external libraries in the future.

1 Like

I did it with webpack, here my set up

1 Like