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

CapacitorGoogleAuth with nextjs typescript build problem #365

Open
mohameddev19 opened this issue May 11, 2024 · 0 comments
Open

CapacitorGoogleAuth with nextjs typescript build problem #365

mohameddev19 opened this issue May 11, 2024 · 0 comments

Comments

@mohameddev19
Copy link

am using Capacitor in next js project
when try ti use CapacitorGoogleAuth i have this error:

 Collecting page data  .D:\Clients_Projects\CIRCLES-UI-mobile\node_modules\@codetrix-studio\capacitor-google-auth\dist\esm\index.js:1
import { registerPlugin } from '@capacitor/core';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:128:18)
    at wrapSafe (node:internal/modules/cjs/loader:1280:20)
    at Module._compile (node:internal/modules/cjs/loader:1332:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at mod.require (D:\Clients_Projects\CIRCLES-UI-mobile\node_modules\next\dist\server\require-hook.js:64:28)
    at require (node:internal/modules/helpers:179:18)
    at 6418 (D:\Clients_Projects\CIRCLES-UI-mobile\.next\server\pages\[locale]\auth\login.js:1:648)

> Build error occurred
Error: Failed to collect page data for /[locale]/auth/login
    at D:\Clients_Projects\CIRCLES-UI-mobile\node_modules\next\dist\build\utils.js:1171:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'Error'
}
   Collecting page data  .

How to fix this SyntaxError error?
this is the component code:

import { registerPlugin } from '@capacitor/core';
import { GoogleAuth } from "@codetrix-studio/capacitor-google-auth";

const LoginForm = () => {

	async function logInWithGoogle() {
		const response = await GoogleAuth.signIn();
		console.log(`token=${response.authentication.accessToken}`);
	}

	return (
	<></>
	);
};

export default LoginForm;
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

1 participant