OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
fix(nextjs-sdk): ensure nextjs sdk runs on next 15 #81
Carl-Gerhard Lindesvärdcc983b3f626e
diff --git a/packages/sdks/nextjs/createNextRouteHandler.ts b/packages/sdks/nextjs/createNextRouteHandler.tsindex fab90651f..867a1a9be 100644--- a/packages/sdks/nextjs/createNextRouteHandler.ts+++ b/packages/sdks/nextjs/createNextRouteHandler.ts@@ -1,4 +1,6 @@-import { NextResponse } from 'next/server';+// adding .js next/script import fixes an issues+// with esm and nextjs (when using pages dir)+import { NextResponse } from 'next/server.js';export function createNextRouteHandler({apiUrl = 'https://api.openpanel.dev',diff --git a/packages/sdks/nextjs/index.tsx b/packages/sdks/nextjs/index.tsxindex ef4059ce7..97d77d25b 100644--- a/packages/sdks/nextjs/index.tsx+++ b/packages/sdks/nextjs/index.tsx@@ -1,4 +1,6 @@-import Script from 'next/script';+// adding .js next/script import fixes an issues+// with esm and nextjs (when using pages dir)+import Script from 'next/script.js';import React from 'react';import type {diff --git a/packages/sdks/nextjs/package.json b/packages/sdks/nextjs/package.jsonindex 9498a3a36..fd6992e1a 100644--- a/packages/sdks/nextjs/package.json+++ b/packages/sdks/nextjs/package.json@@ -10,9 +10,9 @@"@openpanel/web": "1.0.1-local"},"peerDependencies": {- "next": "^12.0.0 || ^13.0.0 || ^14.0.0",- "react": "^16.8.0 || ^17.0.0 || ^18.0.0",- "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"+ "next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"},"devDependencies": {"@openpanel/tsconfig": "workspace:*",diff --git a/tooling/publish/publish.ts b/tooling/publish/publish.tsindex 65d636915..08a215b90 100644--- a/tooling/publish/publish.ts+++ b/tooling/publish/publish.ts@@ -149,8 +149,6 @@ const updatePackageJsonForRelease = (),};- if (name === '@openpanel/nextjs') delete newPkgJson.type;-savePackageJson(workspacePath(`${localPath}/package.json`), newPkgJson);packages[name]!.dependencies = newPkgJson.dependencies;};