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
Phil
(Phil Snow)
3
Hi Yuri,
I'll be happy to debug this with you, can you show me:
- your
_document.js
file
- you
package.json
Thanks.
Please look at this image.
Thanks
Phil
(Phil Snow)
5
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.
Well, then how can I use "createResolver" method there?
Phil
(Phil Snow)
8
OK, it seems the workaround I suggested has made things worse.
Phil
(Phil Snow)
9
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.
Phil
(Phil Snow)
12
Can you try updating your slicezone with
npm i next-slicezone@latest
and change your import back to
import { createResolver } from "next-slicezone/resolver";
1 Like
Yeah, it works as well!
Many thanks, Phil
1 Like
system
(system)
closed as resolved, flag & select 'Something Else' to reopen.
14
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.