use ts relay in dev
This commit is contained in:
@@ -20,6 +20,8 @@ import { Debugger } from './debugger.js'
|
|||||||
import { Editor } from './editor.js'
|
import { Editor } from './editor.js'
|
||||||
import { getStylesForLocator, formatStylesAsText, type StylesResult } from './styles.js'
|
import { getStylesForLocator, formatStylesAsText, type StylesResult } from './styles.js'
|
||||||
import { getReactSource, type ReactSourceLocation } from './react-source.js'
|
import { getReactSource, type ReactSourceLocation } from './react-source.js'
|
||||||
|
const __filename = fileURLToPath(import.meta.url)
|
||||||
|
const __dirname = path.dirname(__filename)
|
||||||
|
|
||||||
class CodeExecutionTimeoutError extends Error {
|
class CodeExecutionTimeoutError extends Error {
|
||||||
constructor(timeout: number) {
|
constructor(timeout: number) {
|
||||||
@@ -261,9 +263,12 @@ async function ensureRelayServer(): Promise<void> {
|
|||||||
mcpLog('CDP relay server not running, starting it...')
|
mcpLog('CDP relay server not running, starting it...')
|
||||||
}
|
}
|
||||||
|
|
||||||
const scriptPath = require.resolve('../dist/start-relay-server.js')
|
const dev = process.env.PLAYWRITER_NODE_ENV === 'development'
|
||||||
|
const scriptPath = dev
|
||||||
|
? path.resolve(__dirname, '../src/start-relay-server.ts')
|
||||||
|
: require.resolve('../dist/start-relay-server.js')
|
||||||
|
|
||||||
const serverProcess = spawn(process.execPath, [scriptPath], {
|
const serverProcess = spawn(dev ? 'tsx' : process.execPath, [scriptPath], {
|
||||||
detached: true,
|
detached: true,
|
||||||
stdio: 'ignore',
|
stdio: 'ignore',
|
||||||
env: {
|
env: {
|
||||||
|
|||||||
@@ -8,5 +8,8 @@ export default defineConfig({
|
|||||||
hookTimeout: 30000,
|
hookTimeout: 30000,
|
||||||
exclude: ['dist', 'dist/**/*', 'node_modules/**'],
|
exclude: ['dist', 'dist/**/*', 'node_modules/**'],
|
||||||
|
|
||||||
|
env: {
|
||||||
|
PLAYWRITER_NODE_ENV: 'development',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user