next-sanity
Version:
Sanity.io toolkit for Next.js
26 lines (25 loc) • 1.33 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import VisualEditingComponent from "next-sanity/visual-editing/client-component";
function VisualEditing(props) {
let autoBasePath;
if (typeof props.basePath !== "string") try {
autoBasePath = process.env["__NEXT_ROUTER_BASEPATH"];
if (autoBasePath) console.log(`Detected next basePath as ${JSON.stringify(autoBasePath)} by reading "process.env.__NEXT_ROUTER_BASEPATH". If this is incorrect then you can set it manually with the basePath prop on the <VisualEditing /> component.`);
} catch (err) {
console.error("Failed detecting basePath", err);
}
let autoTrailingSlash;
if (typeof props.trailingSlash !== "boolean") try {
autoTrailingSlash = Boolean(process.env["__NEXT_TRAILING_SLASH"]);
if (autoTrailingSlash) console.log(`Detected next trailingSlash as ${JSON.stringify(autoTrailingSlash)} by reading "process.env.__NEXT_TRAILING_SLASH". If this is incorrect then you can set it manually with the trailingSlash prop on the <VisualEditing /> component.`);
} catch (err) {
console.error("Failed detecting trailingSlash", err);
}
return /* @__PURE__ */ jsx(VisualEditingComponent, {
...props,
basePath: props.basePath ?? autoBasePath,
trailingSlash: props.trailingSlash ?? autoTrailingSlash
});
}
export { VisualEditing };
//# sourceMappingURL=index.js.map