Rayrun
โ† Back to Discord Forum

require.resolve() problem

.andreidanciuposted in #help-playwright
Open in Discord
.andreidanciu

Hi, I just implemented Playwright in a react project with vite.js but I can't get the custom path in the globalSetup file to work. // playwright.config.ts export default defineConfig({ ... globalSetup: require.resolve('./e2e/globalSetup'), ... }) I changed it to path.resolver but it didn't solve my problem either. globalSetup: path.resolve('./e2e/globalSetup.ts'), Error: ReferenceError: __dirname is not defined in ES module scope at file:///D:/Projects/test/playwright.config.ts:10:32 at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

Do you know how I can fix it? Thanks ๐Ÿ™‚

This thread is trying to answer question "How can I fix the 'ReferenceError: __dirname is not defined in ES module scope' error in my Playwright implementation in a react project with vite.js?"

0 replies

Related Discord Threads

TwitterGitHubLinkedIn
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 [email protected].