-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
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
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'
next.config.js
const withPlugins = require('next-compose-plugins')
const withPreact = require('next-plugin-preact')
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true'
})
const createNextPluginPreval = require('next-plugin-preval/config')
const withNextPluginPreval = createNextPluginPreval()
module.exports = withNextPluginPreval(
withPlugins([
withBundleAnalyzer,
{
productionBrowserSourceMaps: true,
trailingSlash: true,
swcMinify: true,
withPreact
])
)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels