diff --git a/examples/remix/README.md b/examples/remix/README.md index 1155833d..40e56651 100644 --- a/examples/remix/README.md +++ b/examples/remix/README.md @@ -65,6 +65,8 @@ module.exports = { - // Handle image imports - // https://jestjs.io/docs/webpack#handling-static-assets - '^.+\\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/i': `/__mocks__/fileMock.js`, ++ // Handle absolute imports in Remix ++ '~/(.*)': '/app/$1', }, + setupFilesAfterEnv: ['/jest.setup.js'], testPathIgnorePatterns: [ diff --git a/examples/remix/app/routes/index.tsx b/examples/remix/app/routes/index.tsx index e2af82d3..f87fef2d 100644 --- a/examples/remix/app/routes/index.tsx +++ b/examples/remix/app/routes/index.tsx @@ -1,4 +1,4 @@ -import remixImg from '../assets/remix.jpg'; +import remixImg from '~/assets/remix.jpg'; export default function Index() { return ( diff --git a/examples/remix/jest.config.js b/examples/remix/jest.config.js index ddc55579..d4f3418d 100644 --- a/examples/remix/jest.config.js +++ b/examples/remix/jest.config.js @@ -5,6 +5,8 @@ module.exports = { '!**/node_modules/**', ], moduleNameMapper: { + // Handle absolute imports in Remix + '~/(.*)': '/app/$1', }, setupFilesAfterEnv: ['/jest.setup.js'], testPathIgnorePatterns: [