Skip to content

Commit

Permalink
fix(esm-cjs-hell): add module type hint for Playwright
Browse files Browse the repository at this point in the history
Because:
 - fxa-auth-client is used directly in Playwright tests, and Playwright
   has its own require or import logic

This commit:
 - adds "type" in package.json for Playwright to figure it out
  • Loading branch information
chenba authored and julianpoy committed Jul 20, 2023
1 parent 5e4c7a3 commit 31f2b5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/functional-tests/lib/targets/base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import AuthClient from 'fxa-auth-client';
import AuthClient from 'fxa-auth-client/lib/client';
import { EmailClient } from '../email';
import { TargetName } from './index';

Expand Down
6 changes: 5 additions & 1 deletion packages/fxa-auth-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"require": "./dist/server/cjs/packages/fxa-auth-client/server.js"
},
"./browser": "./dist/browser/packages/fxa-auth-client/browser.js",
"./lib/client": {
"import": "./dist/server/esm/packages/fxa-auth-client/lib/client.js",
"require": "./dist/server/cjs/packages/fxa-auth-client/lib/client.js"
},
"./lib/crypto": {
"import": "./dist/server/esm/packages/fxa-auth-client/lib/crypto.js",
"require": "./dist/server/cjs/packages/fxa-auth-client/lib/crypto.js"
Expand All @@ -31,7 +35,7 @@
"scripts": {
"lint": "eslint . --ext .ts",
"postinstall": "(tsc --build tsconfig.browser.json && tsc --build) || true",
"build": "tsc --build tsconfig.browser.json && tsc --build && tsc --build tsconfig.cjs.json",
"build": "tsc --build tsconfig.browser.json && tsc --build && tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > ./dist/server/cjs/packages/fxa-auth-client/package.json",
"compile": "tsc --noEmit",
"ts-check": "tsc --noEmit",
"test": "mocha -r esbuild-register test/*",
Expand Down

0 comments on commit 31f2b5d

Please sign in to comment.