From 11b793be949ce0e65698ec2a2886ec8682ec634c Mon Sep 17 00:00:00 2001 From: Lukasz Ostrowski Date: Wed, 26 Apr 2023 13:38:13 +0200 Subject: [PATCH] Change import from next/router to use wildcard (#234) --- .changeset/selfish-pigs-film.md | 5 +++++ src/app-bridge/next/route-propagator.tsx | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/selfish-pigs-film.md diff --git a/.changeset/selfish-pigs-film.md b/.changeset/selfish-pigs-film.md new file mode 100644 index 0000000..02092c0 --- /dev/null +++ b/.changeset/selfish-pigs-film.md @@ -0,0 +1,5 @@ +--- +"@saleor/app-sdk": patch +--- + +Changed import type from next/router, that fixes Next 13.3.1 build diff --git a/src/app-bridge/next/route-propagator.tsx b/src/app-bridge/next/route-propagator.tsx index 456371a..c9d715d 100644 --- a/src/app-bridge/next/route-propagator.tsx +++ b/src/app-bridge/next/route-propagator.tsx @@ -1,12 +1,14 @@ /** * Use .js extension to avoid broken builds with ESM */ -import { useRouter } from "next/router.js"; +import * as NextRouter from "next/router.js"; import { useEffect } from "react"; import { actions } from "../actions"; import { useAppBridge } from "../app-bridge-provider"; +const { useRouter } = NextRouter; + /** * Synchronizes app inner state (inside iframe) with dashboard routing, so app's route can be restored after refresh */