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

[Feature] Support ES module syntax #2269

Closed
davidgilbertson opened this issue May 17, 2020 · 2 comments · Fixed by #3125
Closed

[Feature] Support ES module syntax #2269

davidgilbertson opened this issue May 17, 2020 · 2 comments · Fixed by #3125
Assignees

Comments

@davidgilbertson
Copy link
Contributor

I'm using ES modules with Node 14. I can import Playwright like this:

import playwright from 'playwright';

const { webkit } = playwright;

But not like this:

import { webkit } from 'playwright';

This is because the build is CommonJS format, with no ES module variant. Which I guess is because you're using Webpack. For this feature request, you'd need to either switch to Rollup (IMO a better fit for npm packages) or wait for Webpack to support it (it's in the works for V5).

@GeorgeWL
Copy link

GeorgeWL commented May 20, 2020

Doesn't the esModuleInterop flag in webpack also allow that style of import?

@davidgilbertson
Copy link
Contributor Author

@GeorgeWL could you elaborate? Are you referring to Webpack in the build of Playwright? Or are you proposing that users of Playwright use Webpack to transpile their code?

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

Successfully merging a pull request may close this issue.

5 participants