← Back to Discord Forum

Playwright is unable to resolve import from a custom package

Mirgrating to playwright from cypress and I trying to import mocks from node_modules/@custom_package It complains when there is the import statement refers to type declaration (*.d.ts)

Example: import {ErrorCodes} from '@custom_package/**/enums'

Error: Error: Cannot find module `/node_modules/@custom_package/**/enums

I appreciate any help to resolve this issue.

This thread is trying to answer question "How can I resolve the issue of Playwright being unable to import from a custom package?"

5 replies

I think you need a customized tsconfig.json

Thank you! @jan.ostgren Could you share a sample tsconfig?

Will see if I find one

baseUrl": ".", "paths": { "@e2e-support/": ["support/"], "@e2e-test.config": ["test.config.ts"] }

Thank you! let me try..

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.