This morning, my local Node.js version was automatically updated to 23.6.0 via Homebrew. While the update itself seemed harmless at first, it led to some mysterious errors when using Playwright with a TypeScript configuration:
(node:27126) ExperimentalWarning: Type Stripping is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
SyntaxError: The requested module '@playwright/experimental-ct-react' does not provide an export named 'PlaywrightTestConfig'
SyntaxError: The requested module '@playwright/experimental-ct-react' does not provide an export named 'PlaywrightTestConfig'
After some investigation and Googling, I discovered that Node.js is now beginning to natively support TypeScript. The TypeScript type-stripping feature, previously gated behind a flag, seems to be more generally applied.
For reference, you can check out the new documentation:
Node.js TypeScript Support
To fix this issue, it’s important to address TypeScript type imports. Moving forward, it’s a good idea to explicitly mark your type-only imports. Here’s an example:
- import { PlaywrightTestConfig } from '@playwright/experimental-ct-react';
+ import type { PlaywrightTestConfig } from '@playwright/experimental-ct-react';
I tested the consistent-type-imports
ESLint rule locally and ran eslint . --fix
, which resolved the issues. This approach makes the code compatible with Node.js 23.6+.
If you’re unable to make these changes immediately, you can disable the experimental type-stripping feature by setting a Node.js environment option:
export NODE_OPTIONS="--no-experimental-strip-types"
For more details, check the CLI documentation:
Node.js CLI Options
With these adjustments, your project should run smoothly again. I hope this information saves you some time and helps you avoid the same confusion I encountered.
Happy coding! 🚀