Next.js Discord

Discord Forum

SyntaxError: Invalid or unexpected token import searchIcon from '@/assets/icons/search.png';

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
I'm having trouble testing my components and screens with jest because I have this import for my images, does anyone know how to fix it? i tried this: https://nextjs.org/docs/pages/guides/testing/jest#handling-stylesheets-and-image-imports

1 Reply

Sun bearOP
with this as well:


'\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/mocks/fileMock.js',
'\.(css|less)$': '<rootDir>/mocks/styleMock.js',

https://jestjs.io/docs/webpack#handling-static-assets