-
Notifications
You must be signed in to change notification settings - Fork 14
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
Transition package from CJS to ESM #35
Comments
@christian-bromann is there prior art on any of the other service plugins? Switching to ESM is pretty trivial, ensuring support of CJS at the same time is not. I was considering this approach to support both: |
I am currently working in the WebdriverIO repo on the same thing. Currently it only creates ESM files but I want to find a way to also have a CJS export. I think I can achieve this with having two TypeScript configs as mentioned in the article. |
webdriverio main repo using webdriverio/webdriverio@25cbb4d |
@goosewobbler I tried |
just fyi: I have been successfully experimenting with |
Another fyi: there is no need to have services and reporter export a ESM and CJS version. ESM only will be completely fine. Also the ESM transition can be done even after the v8 release given that you can import CJS modules in ESM. |
So it's ok to have this service export ESM only? |
Yes. ESM modules can import CJS modules. |
Presumably switching to only ESM will mean that the service will be incompatible with WDIO < v8? |
That is correct. We could implement dynamic import to enable support for ESM plugins in v7.x though. |
Looked into this again and prototyped it. Seems ESM still needs some time to bake in many areas of the ecosystem. Also would prefer to wait until ESM is no longer experimental in Node. Jest is the main problem for this repo, when they have implemented a clean way to do mocking for ESM amongst other things, it should be a lot easier. I will keep this ticket open and look at it again in time. |
@goosewobbler there is no rush to move to ESM given that WebdriverIO |
I now have a reference PR for moving a service to ESM, check out the
Let me know if you have any questions. I have released an alpha version of |
Hi @christian-bromann, I decided to dedicate some time to unbitrotting this service. My initial updates including chromedriver downloading and ESM updates can be found here: https://github.com/webdriverio-community/wdio-electron-service/tree/update-deps The chromedriver downloading seems to work but I can't get my integration tests to work due to ESM errors. Going to look at moving the |
Including the example makes sense but I wouldn't transform the repo into a monorepo. Maybe just add the example into an |
Updated for this approach. I think it's close to working but getting a bunch of these errors. Tried a lot of different things mostly around trying to set the ts-node esm flag but it does nothing...
|
Released with v4 |
As part of the v8 effort we are currently migrating over to ESM as many packages will stop support CJS in the future. This means we have to transition all plugins to ESM as well, ideally with continuous support for CJS.
The text was updated successfully, but these errors were encountered: