Edit
I managed to work around this like so for now. Not sure what’s going on, but it will have to do.
I’m using my modules with import
, (I feel like I should point this out, because in a previous project, I didn’t have this issue with require(..)
) and Node keeps throwing the below error:
import { Expo } from 'expo-server-sdk';
^^^^
SyntaxError: The requested module 'expo-server-sdk' does not provide an export named 'Expo'
What can be going on here?
Relevant code:
...
import { Expo } from 'expo-server-sdk';
...
export const sendNotification = async (newMessage) => {
try {
let expo = new Expo(); // <-- Would crash here.
. . .
If I import it like this intead,
import Expo from 'expo-server-sdk';
Then it would compile, but crash at let expo = new Expo()
and throw the error,
TypeError: Expo is not a constructor
I took a look at the exports in the sdk, and it names exports.default = Expo
, so I’m beyond confused as to why Node isn’t recognising it. Maybe I’m misunderstanding here, because VS Code sees it, and correctly auto-imports it as import { Expo } from 'expo-server-sdk';
: