Fix mocking dev modules in new Turbopack version
This commit is contained in:
gbuomprisco
2025-04-10 14:02:02 +08:00
parent af84676454
commit 765cef8736
4 changed files with 24 additions and 10 deletions

View File

@@ -5,8 +5,16 @@
It allows the development server to load faster by not loading the modules that are not needed. It allows the development server to load faster by not loading the modules that are not needed.
*/ */
// Turnstile
export const Turnstile = undefined; export const Turnstile = undefined;
export const TurnstileProps = {}; export const TurnstileProps = {};
// Baselime
export const useBaselimeRum = undefined; export const useBaselimeRum = undefined;
export const BaselimeRum = undefined; export const BaselimeRum = undefined;
// Sentry
export const captureException =() => ({});
export const captureEvent = () => ({});
export const setUser = () => ({});
export const init = () => ({});

View File

@@ -1,6 +1,6 @@
{ {
"name": "next-supabase-saas-kit-turbo", "name": "next-supabase-saas-kit-turbo",
"version": "2.7.0", "version": "2.7.1",
"private": true, "private": true,
"sideEffects": false, "sideEffects": false,
"engines": { "engines": {

View File

@@ -1,4 +1,4 @@
import * as Sentry from '@sentry/nextjs'; import { init } from '@sentry/nextjs';
type Parameters<T extends (args: never) => unknown> = T extends ( type Parameters<T extends (args: never) => unknown> = T extends (
...args: infer P ...args: infer P
@@ -12,9 +12,9 @@ type Parameters<T extends (args: never) => unknown> = T extends (
* @param props * @param props
*/ */
export function initializeSentryServerClient( export function initializeSentryServerClient(
props: Parameters<typeof Sentry.init>[0] = {}, props: Parameters<typeof init>[0] = {},
) { ) {
return Sentry.init({ return init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
// ... // ...

View File

@@ -1,4 +1,10 @@
import * as Sentry from '@sentry/nextjs'; import {
Event as SentryEvent,
User as SentryUser,
captureEvent,
captureException,
setUser,
} from '@sentry/nextjs';
import { MonitoringService } from '@kit/monitoring-core'; import { MonitoringService } from '@kit/monitoring-core';
@@ -24,18 +30,18 @@ export class SentryMonitoringService implements MonitoringService {
} }
captureException(error: Error | null) { captureException(error: Error | null) {
return Sentry.captureException(error); return captureException(error);
} }
captureEvent<Extra extends Sentry.Event>(event: string, extra?: Extra) { captureEvent<Extra extends SentryEvent>(event: string, extra?: Extra) {
return Sentry.captureEvent({ return captureEvent({
message: event, message: event,
...(extra ?? {}), ...(extra ?? {}),
}); });
} }
identifyUser(user: Sentry.User) { identifyUser(user: SentryUser) {
Sentry.setUser(user); setUser(user);
} }
private async initialize() { private async initialize() {