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

Rollback to module-name import to fix defaults issue #40

Merged
merged 1 commit into from
Aug 18, 2024

Conversation

rajeshdavidbabu
Copy link
Contributor

@rajeshdavidbabu rajeshdavidbabu commented Jul 18, 2024

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
#36

@rajeshdavidbabu rajeshdavidbabu changed the title Rollback to module-name import Rollback to module-name import to fix defaults issue Jul 18, 2024
@prathyusha586-0408
Copy link

prathyusha586-0408 commented Jul 19, 2024

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

@rajeshdavidbabu
Copy link
Contributor Author

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

Did you make a local build and use that build ?

@prathyusha586-0408
Copy link

prathyusha586-0408 commented Jul 19, 2024

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

@rajeshdavidbabu
Copy link
Contributor Author

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.

@prathyusha586-0408
Copy link

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
Copy link

Anyone helping me here?

@rajeshdavidbabu
Copy link
Contributor Author

@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>'

@ictsuzukicerby
Copy link

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!

@seniorQAautomationEngineer

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

@rajeshdavidbabu
Copy link
Contributor Author

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

@prathyusha586-0408
Copy link

@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

@chris-mclennan
Copy link

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

@lucgagan lucgagan merged commit 9951c33 into lucgagan:main Aug 18, 2024
1 check passed
@stoyanov-x
Copy link

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

@chris-mclennan
Copy link

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')

@tmbridge
Copy link

I'm also still getting this error.

@ohlori
Copy link

ohlori commented Oct 4, 2024

I'm still getting this error too

@laiyee-asm
Copy link

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.

@gregbrandt
Copy link

@lucgagan Is this fix going to be release?

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 this pull request may close these issues.