Skip to content

Instantly share code, notes, and snippets.

@mathiasschopmans
Last active January 8, 2025 14:09
Show Gist options
  • Save mathiasschopmans/2ad4dca0c41a06ad990da651e27c20ba to your computer and use it in GitHub Desktop.
Save mathiasschopmans/2ad4dca0c41a06ad990da651e27c20ba to your computer and use it in GitHub Desktop.
Resolving Playwright Issues with Node.js 23.6.0 and Type Stripping

Resolving Playwright Issues with Node.js 23.6.0 and Type Stripping

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

Preparing Your Project for Node.js 23.6+

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+.

Temporary Workaround

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! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment