Skip to content

Commit

Permalink
📦️ chore(core): Exclude @playwright/test from bundling (#985)
Browse files Browse the repository at this point in the history
  • Loading branch information
duckception authored Nov 11, 2023
1 parent 46b9047 commit 28d1339
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
16 changes: 0 additions & 16 deletions packages/core/src/cli/compilationFixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,10 @@ var __dirname = (await import("node:path")).dirname(__filename);
// ---- DYNAMIC_REQUIRE_FS_FIX ----
`.trim()

// Fixes -> Error: Cannot find module '../package.json'
// This issue is related to the Playwright test runner.
const PLAYWRIGHT_RELATIVE_PACKAGE_IMPORT_FIX = `
// ---- PLAYWRIGHT_RELATIVE_PACKAGE_IMPORT_FIX ----
var originalRequireResolve = require.resolve;
require.resolve = (id, ...args) => {
if (id.endsWith("/package.json")) {
id = require("node:path").join(process.cwd(), "package.json");
}
return originalRequireResolve(id, ...args);
}
// ---- PLAYWRIGHT_RELATIVE_PACKAGE_IMPORT_FIX ----
`.trim()

export const FIXES_BANNER = `
/// ######## BANNER WITH FIXES START ########
${DYNAMIC_REQUIRE_FS_FIX}
${PLAYWRIGHT_RELATIVE_PACKAGE_IMPORT_FIX}
/// ######## BANNER WITH FIXES END ########
`.trimStart()
1 change: 1 addition & 0 deletions packages/core/src/cli/compileWalletSetupFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export async function compileWalletSetupFunctions(walletSetupDir: string) {
splitting: true,
sourcemap: false,
config: false,
external: ['@playwright/test'],
banner: {
js: FIXES_BANNER
},
Expand Down

0 comments on commit 28d1339

Please sign in to comment.