Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: bundle open's xdg-open script (#23710)

Max Schmitt60de8308a8c9
diff --git a/packages/playwright-core/.npmignore b/packages/playwright-core/.npmignore
index 132b57f597..c13cb08254 100644
--- a/packages/playwright-core/.npmignore
+++ b/packages/playwright-core/.npmignore
@@ -9,6 +9,7 @@
!lib/**/*.html
!lib/**/*.png
!lib/**/*.ttf
+!lib/xdg-open
# Exclude injected files. A preprocessed version of these is included via lib/generated.
# See src/server/injected/README.md.
lib/**/injected/
diff --git a/packages/playwright-core/bundles/utils/build.js b/packages/playwright-core/bundles/utils/build.js
index 4c947f73fa..ac8f8c6c00 100644
--- a/packages/playwright-core/bundles/utils/build.js
+++ b/packages/playwright-core/bundles/utils/build.js
@@ -17,6 +17,12 @@
// @ts-check
const path = require('path');
const esbuild = require('esbuild');
+const fs = require('fs');
+
+{
+ // 'open' package requires 'xdg-open' script to be present, which does not get bundled by esbuild.
+ fs.copyFileSync(path.join(__dirname, 'node_modules/open/xdg-open'), path.join(__dirname, '../../lib/xdg-open'));
+}
esbuild.build({
entryPoints: [path.join(__dirname, 'src/utilsBundleImpl.ts')],