Hi, Prismic Support team!
I am implementing the Preview feature when content changes in Prismic.
So followed this instruction.
But I get a SyntaxError: Cannot use import statement outside a module
Please help me to solve this error.
Thanks,
Yurii
Hi, Prismic Support team!
I am implementing the Preview feature when content changes in Prismic.
So followed this instruction.
But I get a SyntaxError: Cannot use import statement outside a module
Please help me to solve this error.
Thanks,
Yurii
Hi Yuri,
I'll be happy to debug this with you, can you show me:
_document.js filepackage.json
Thanks.
Hi Yurri,
I'm guessing this is coming from the configuration of your project, maybe the linting or something, the following article explains how to fix it:
But essentially you'll need to import the file like this I guess:
<script type="module" src="next-slicezone/resolver"></script>
Let me know if this helps.
Thanks.

OK, it seems the workaround I suggested has made things worse.
What does your next.config.js file look like?

There is no importing 'createResolver' from the next-slicezone/resolver code in this instruction.
So I've removed it and I think it works well now.
Can you try updating your slicezone with
npm i next-slicezone@latest
and change your import back to
import { createResolver } from "next-slicezone/resolver";
Yeah, it works as well!
Many thanks, Phil

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.