I have a pnpm monorepo. One of the packages which is not a vite app and is using
import.meta.env but is used exclusively by vite (see vite env variables: https://vitejs.dev/guide/env-and-mode.html#env-variables). This works for our apps, because all of them importing the package including
import.meta.env. Though, when I start a playwright test it complains.
How can I fix this?
This thread is trying to answer question "How can I fix the 'SyntaxError: Cannot use 'import.meta' outside a module' error when starting a playwright test in a pnpm monorepo?"
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@example.com.