TypeError: MWeb3 is not a constructor

I’m trying to use the Moralis crypto login from an Angular application.

import Moralis from 'moralis/dist/moralis.js';

Moralis.initialize('[appId]');
Moralis.serverURL = '[url]';

export class MoralisService {
  constructor() {}

  public login(): void {
    Moralis.Web3.authenticate()
      .then((user: any) => {
        console.log(user);
      });
  }
}

Calling the function throws the following error: TypeError: MWeb3 is not a constructor

same when trying to call Moralis.Web3.enable()

Version 0.0.17

Hey check this Moralis Angular login boilerplate https://github.com/MoralisWeb3/demo-apps/tree/main/moralis-angular-app

Try changing the import to:

import Moralis from 'moralis';

I installed and ran the demo app, it worked, I tried to use it as a reference for my angular app and it doesn’t work. I guess it’s more of an Angular issue than moralis

oh god, I had my cloud functions backed up in a file called moralis.js in my root folder and Angular thought that this was the module and thus caused the error. Renaming the file fixed it