diff --git a/packages/sdks/nextjs/createNextRouteHandler.ts b/packages/sdks/nextjs/createNextRouteHandler.ts index fab90651..867a1a9b 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.tsx index ef4059ce..97d77d25 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.json index 9498a3a3..fd6992e1 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.ts index 65d63691..08a215b9 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; };