auto-playwright icon indicating copy to clipboard operation
auto-playwright copied to clipboard

Rollback to module-name import to fix defaults issue

Open rajeshdavidbabu opened this issue 1 year ago • 11 comments

Why ?

Based on the official docs of sanitize-html we need do the following:

If esModuleInterop=true is not set in your tsconfig.json file, you have to import it with:

import * as sanitizeHtml from 'sanitize-html';

Problem:

  • Currently, we use default import (eg: import sanitizeHtml from 'sanitize-html') and the resulting js bundle currently would look for the following, which is wrong I assume : Screenshot 2024-07-18 at 13 23 03

Fix:

  • So a module-name import (* as module-name) would result in the right invocation like the following: Screenshot 2024-07-18 at 13 24 02

Connected issue https://github.com/lucgagan/auto-playwright/issues/36

rajeshdavidbabu avatar Jul 18 '24 11:07 rajeshdavidbabu

I have used below import statement but still facing the same issue. image

prathyusha586-0408 avatar Jul 19 '24 05:07 prathyusha586-0408

I have used below import statement but still facing the same issue. image

Did you make a local build and use that build ?

rajeshdavidbabu avatar Jul 19 '24 08:07 rajeshdavidbabu

Local build you mean the sanitize-html installation into the libraries? If so, yes. Using "npm install sanitize-html".

prathyusha586-0408 avatar Jul 19 '24 08:07 prathyusha586-0408

Afaik, this should work as I tested it locally and also using an npm build.

@lucgagan would be nice to have this in sooner cos the main currently breaks.

rajeshdavidbabu avatar Jul 19 '24 18:07 rajeshdavidbabu

Afaik, this should work as I tested it locally and also using an npm build.

@lucgagan would be nice to have this in sooner cos the main currently breaks.

@rajeshdavidbabu , can you help me with the steps how you made the local build of the sanitize-html? bcz still am facing the issue.

prathyusha586-0408 avatar Jul 22 '24 05:07 prathyusha586-0408

Anyone helping me here?

prathyusha586-0408 avatar Jul 24 '24 04:07 prathyusha586-0408

@prathyusha586-0408 okay this is not yet merged so alternatively you can do the following:

  • make this change and

I have used below import statement but still facing the same issue. image

yeah are you using the local auto or the auto from npm ?

Go to the file where you use import auto from 'auto-playwright' and change it to import auto from '../<your local path to auto.ts>'

rajeshdavidbabu avatar Jul 24 '24 08:07 rajeshdavidbabu

Hi folks,

Wondering if this fix will be merged soon, I am working on a POC and this tool looks very interesting.

Thanks for all your effort!

ictsuzukicerby avatar Jul 30 '24 21:07 ictsuzukicerby

Please merge the fix, guys. This is blocker for running tests.

@lucgagan let me know if there is something wrong with this one. If not we have to merge it inorder to unblock users.

rajeshdavidbabu avatar Jul 31 '24 14:07 rajeshdavidbabu

@prathyusha586-0408 okay this is not yet merged so alternatively you can do the following:

  • make this change and

I have used below import statement but still facing the same issue. image

yeah are you using the local auto or the auto from npm ?

Go to the file where you use import auto from 'auto-playwright' and change it to import auto from '../<your local path to auto.ts>'

@rajeshdavidbabu , i have tried as mentioned but getting below error: image

prathyusha586-0408 avatar Aug 06 '24 04:08 prathyusha586-0408

I tried to use auto-playwright but also ran into this issue. What is holding this up?

chris-mclennan avatar Aug 18 '24 16:08 chris-mclennan

@lucgagan When can a new release/npm package version be expected?

stoyanov-x avatar Aug 19 '24 16:08 stoyanov-x

I still can't get this to work out of the box. Like the others, I am getting: TypeError: Cannot read properties of undefined (reading 'defaults')

chris-mclennan avatar Aug 27 '24 06:08 chris-mclennan

I'm also still getting this error.

tmbridge avatar Sep 23 '24 20:09 tmbridge

I'm still getting this error too

ohlori avatar Oct 04 '24 10:10 ohlori

I've revert the sanitizeHtml.ts import from import * as sanitizeHtml from 'sanitize-html'; to import sanitize from "sanitize-html"; And, I tested it locally and also using an npm build.

laiyee-asm avatar Oct 08 '24 11:10 laiyee-asm

Can you get this deployed? this not working with me.

harishdhande01 avatar Feb 07 '25 17:02 harishdhande01

I'm not able to use this package, can you @lucgagan please fix it?

MartinHutyra avatar Mar 04 '25 20:03 MartinHutyra

:tada: This PR is included in version 1.16.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar May 01 '25 13:05 github-actions[bot]