Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REGRESSION][1.9.0]: Cannot find module 'electron' or its corresponding type declarations #5585

Closed
AviVahl opened this issue Feb 24, 2021 · 14 comments
Assignees

Comments

@AviVahl
Copy link

AviVahl commented Feb 24, 2021

Context:

  • GOOD Playwright Version: 1.8.0
  • BAD Playwright Version: 1.9.0
  • Operating System: Linux. Fedora 33.
  • Extra: using playwright-core. skipLibCheck is not turned on.

Code Snippet

const {chromium, webkit, firefox} = require('playwright-core');

(async () => {
  const browser = await chromium.launch();
  // ... 
})();

Describe the bug

After upgrading to the new version, I see the following type errors when using playwright-core programmatically:

node_modules/playwright-core/types/types.d.ts:7098:63 - error TS2307: Cannot find module 'electron' or its corresponding type declarations.
7098   evaluate<R, Arg>(pageFunction: PageFunctionOn<typeof import('electron'), Arg, R>, arg: Arg): Promise<R>;
                                                                   ~~~~~~~~~~

node_modules/playwright-core/types/types.d.ts:7099:58 - error TS2307: Cannot find module 'electron' or its corresponding type declarations.
7099   evaluate<R>(pageFunction: PageFunctionOn<typeof import('electron'), void, R>, arg?: any): Promise<R>;
                                                              ~~~~~~~~~~

node_modules/playwright-core/types/types.d.ts:7120:69 - error TS2307: Cannot find module 'electron' or its corresponding type declarations.
7120   evaluateHandle<R, Arg>(pageFunction: PageFunctionOn<typeof import('electron'), Arg, R>, arg: Arg): Promise<SmartHandle<R>>;
                                                                         ~~~~~~~~~~

node_modules/playwright-core/types/types.d.ts:7121:64 - error TS2307: Cannot find module 'electron' or its corresponding type declarations.
7121   evaluateHandle<R>(pageFunction: PageFunctionOn<typeof import('electron'), void, R>, arg?: any): Promise<SmartHandle<R>>;
                                                                    ~~~~~~~~~~

Found 4 errors.
@mxschmitt
Copy link
Member

Sems like already fixed in #5572 and cherry-picked in #5576. Should get released as 1.9.1 shortly.

@aslushnikov
Copy link
Collaborator

The fix was merged in v1.9.1 and 1.9.1 is live!

@mxschmitt
Copy link
Member

Can verify it works!

@joelgriffith
Copy link

Thanks @aslushnikov!

@aarvay
Copy link

aarvay commented Apr 5, 2021

Breaks in 1.10.0

@AviVahl
Copy link
Author

AviVahl commented Apr 5, 2021

Breaks in 1.10.0

odd. we're using 1.10.0 and no issue. re-verify the local version.

@aarvay
Copy link

aarvay commented Apr 7, 2021

Re-verified local version. 1.10.0.

node_modules/playwright-core/lib/server/electron/electron.js:129:66: error: Could not resolve "electron/index.js" (mark it as external to exclude it from the bundle)
    129 │ ...utablePath: options.executablePath || require('electron/index.js'),

@aarvay
Copy link

aarvay commented Apr 7, 2021

Last working version for me was 1.8.0. Even 1.9.1 doesn't work. I get the same error.

@AviVahl
Copy link
Author

AviVahl commented Apr 7, 2021

that doesn't look like a type error. which tool/lib is giving you this error?

@aarvay
Copy link

aarvay commented Apr 7, 2021

esbuild

@AviVahl
Copy link
Author

AviVahl commented Apr 7, 2021

ah, might want to open a separate issue and give exact steps to reproduce, expected behavior, etc...

@aarvay
Copy link

aarvay commented Apr 8, 2021

@AviVahl will do that! thanks.

@mikejackowski
Copy link

mikejackowski commented Mar 21, 2022

Still happening to me, playwright-core 1.20, building using tsc

Could not resolve "electron/index.js" (mark it as external to exclude it from the bundle)

@AviVahl
Copy link
Author

AviVahl commented Mar 21, 2022

@mikejackowski
That's not an error from tsc. It's an error from some bundler (I'm guessing esbuild, but you'd be the one to say).
You probably need to avoid trying to bundle playwright, or any test file that imports it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants