Parsing Errors: Cannot Find Module

I am trying to deploy my firebase function to the cloud, but I get an error:

Error: Parsing Triggers: Cannot find module 'EmailData'

1. Let's compile the ts file to js.

2. Building ts ok ... my code looks like this:

ts importing file ...

var EmailDataClass = require("EmailData");

      

and the file itself:

class EmailData {....
}export = EmailData;

      

✔  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...

Error: Error parsing triggers: Cannot find module 'EmailData'

      

+3


source to share


1 answer


It is not recommended to use a combination of Typescript and ES6 export and import methods

it's better to use script import type

import { EmailDataClass } from "./EmailData";

      



And for export use

export class EmailData {....
}

      

+1


source







All Articles