Skip to content

Commit 941da85

Browse files
committed
fix playwriter
1 parent 38fe7aa commit 941da85

File tree

5 files changed

+20
-31
lines changed

5 files changed

+20
-31
lines changed

.mcp.json

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,8 @@
11
{
2-
"mcpServers": {
3-
"playwriter": {
4-
"command": "pnpm",
5-
"args": [
6-
"--filter",
7-
"playwriter",
8-
"mcp"
9-
]
10-
},
11-
"lsp": {
12-
"command": "mcp-language-server",
13-
"args": [
14-
"--workspace",
15-
"/Users/morse/Documents/GitHub/fumabase/",
16-
"--lsp",
17-
"typescript-language-server",
18-
"--",
19-
"--stdio"
20-
]
21-
},
22-
"framer": {
23-
"type": "sse",
24-
"url": "https://mcp.unframer.co/sse?id=598f176d590e612e9b6bcaebb54abb0a8763c6f54ba5b9c136690ff9ad2400cc&secret=FpGeQQcnvd9CpFvZwEdONuAjEX7c6AwJ"
2+
"mcpServers": {
3+
"playwriter": {
4+
"command": "npx",
5+
"args": ["-y", "playwriter@latest"]
6+
}
257
}
26-
}
27-
}
8+
}

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ also keep in mind it's preferable to throw redirects in loaders instead of retur
282282

283283
## typescript
284284

285+
NEVER use require. always esm imports
286+
285287
Always try to use non relative imports, each package has a absolute import with the package name, you can find it in the tsconfig.json paths section, for example paths inside website can be imported from website. Notice these paths also need to include the src directory.
286288

287289
This is preferable other aliases like @/ because i can easily move the code from one package to another without changing the import paths. This way you can even move a file and import paths do not change much.

playwriter/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 0.0.3
4+
5+
### Patch Changes
6+
7+
- Replace CommonJS `require` with ESM `import` for user-agents module
8+
39
## 2025-07-24 22:15
410

511
- Changed Chrome process stdio from 'ignore' to 'inherit' to print Chrome logs

playwriter/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "playwriter",
33
"description": "",
4-
"version": "0.0.1",
4+
"version": "0.0.3",
55
"type": "module",
66
"repository": "https://github.com/remorses/",
77
"scripts": {
8-
"build": "rm -rf dist && tsc",
8+
"build": "rm -rf dist *.tsbuildinfo && mkdir dist && cp src/prompt.md dist/ && tsc",
99
"prepublishOnly": "pnpm build",
1010
"watch": "tsc -w",
1111
"typecheck": "tsc --noEmit",

playwriter/src/mcp.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ async function ensureConnection(): Promise<{ browser: Browser; page: Page }> {
146146
}
147147

148148
// Generate user agent and set it on context
149-
const ua = require('user-agents')
150-
const userAgent = new ua({
149+
const { default: UserAgent } = await import('user-agents')
150+
const userAgent = new UserAgent({
151151
platform: 'MacIntel',
152152
deviceCategory: 'desktop',
153153
})
@@ -270,8 +270,8 @@ server.tool(
270270
const newPage = await context.newPage()
271271

272272
// Set user agent on new page
273-
const ua = require('user-agents')
274-
const userAgent = new ua({
273+
const { default: UserAgent } = await import('user-agents')
274+
const userAgent = new UserAgent({
275275
platform: 'MacIntel',
276276
deviceCategory: 'desktop',
277277
})

0 commit comments

Comments
 (0)