Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[help wanted] I am importing the Cannot use import statement outside a module issue #139

Open
xiningli opened this issue Dec 20, 2022 · 4 comments

Comments

@xiningli
Copy link

Could someone just give me some help?
I am trying to import the @capacitor-community/fcm in my NEXTJS project.
And I am facing this issue.

There is no issue for me to import { PushNotifications } from '@capacitor/push-notifications';

But when I am trying to import the import { FCM } from "@capacitor-community/fcm";

I am seeing the following issue.

info - Collecting page data ./[mypath]/node_modules/@capacitor-community/fcm/dist/esm/index.js:1
import { registerPlugin } from "@capacitor/core";
^^^^^^

SyntaxError: Cannot use import statement outside a module

@Saqib92
Copy link

Saqib92 commented Dec 30, 2022

Could someone just give me some help? I am trying to import the @capacitor-community/fcm in my NEXTJS project. And I am facing this issue.

There is no issue for me to import { PushNotifications } from '@capacitor/push-notifications';

But when I am trying to import the import { FCM } from "@capacitor-community/fcm";

I am seeing the following issue.

info - Collecting page data ./[mypath]/node_modules/@capacitor-community/fcm/dist/esm/index.js:1 import { registerPlugin } from "@capacitor/core"; ^^^^^^

SyntaxError: Cannot use import statement outside a module

facing exactly the same issue.

@QualitasGit
Copy link

Same issue here.
Anyone found a solution?

@lohnsonok
Copy link

Same issue for me too

@AlexCyphus
Copy link

AlexCyphus commented Jul 6, 2023

Hey! If you're using NextJS - you can fix it by transpiling the package in your next config file. You can find more info here: https://nextjs.org/docs/app/api-reference/next-config-js/transpilePackages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants