Preval is great and fixes performance issues I was experiencing around constantly re-fetching data during a build. However, one minor problem I have is that Preval can't find modules whose imports are prefixed with @. If I convert the imports to absolute paths Preval works great. I assume there is something simple I'm missing. Any help would be appreciated. Thanks.
Error Message
Error: Failed to pre-evaluate "~/sites/rdc-nextjs-wp-poc/functions/wordpress/archives/getAndCacheAllPosts.preval.js". Error: Cannot find module '@/lib/wordpress/connector.js'
Imports from getAndCacheAllPosts.preval.js
import preval from 'next-plugin-preval'
import {initializeWpApollo} from '@/lib/wordpress/connector.js'
import {gql} from '@apollo/client'
I converted the imports to the below and Preval works
import preval from 'next-plugin-preval'
import {initializeWpApollo} from '../../../lib/wordpress/connector.js'
import {gql} from '../../../node_modules/@apollo/client'
Hi all -
Preval is great and fixes performance issues I was experiencing around constantly re-fetching data during a build. However, one minor problem I have is that Preval can't find modules whose imports are prefixed with
@
. If I convert the imports to absolute paths Preval works great. I assume there is something simple I'm missing. Any help would be appreciated. Thanks.Error Message
Imports from getAndCacheAllPosts.preval.js
I converted the imports to the below and Preval works
next.config.js