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

Bower issues : DOMPurify is not defined #961

Closed
HakumenNC opened this issue May 21, 2024 · 5 comments
Closed

Bower issues : DOMPurify is not defined #961

HakumenNC opened this issue May 21, 2024 · 5 comments

Comments

@HakumenNC
Copy link

Background & Context

Hi, sorry in advance for my broken english.
We had a legacy project based on bower dependencies management.
Thanks, this project is available in this.

Bug

When the project started, i have this :

Uncaught ReferenceError: DOMPurify is not defined

On check in bower file bower.json and .bower.json, the main file declared is :

"main": "src/purify.js",

I think the right file to use must be : /dist/purify.min.js
After some tests with this dist file, it work like a charm

Input

<html>
    <head>
        <script type="text/javascript" src="./bower_components/dompurify/dist/purify.min.js"></script>
        <script>
            var clean = DOMPurify.sanitize("<p>dirty</p>", { ALLOWED_TAGS: [] });
            console.log(clean)
        </script>
    </head>
</html>

Here a mini use case : bower_and_dompurify.zip

Given output

Output with actual bower files :

Uncaught ReferenceError: DOMPurify is not defined

Expected output

No error

Regards

cure53 added a commit that referenced this issue May 23, 2024
fix: Fixed path to main file in bower.js
@cure53
Copy link
Owner

cure53 commented May 23, 2024

Heya, oha, thanks for noticing, does the commit linked above fix the issue for you?

@HakumenNC
Copy link
Author

Hello, thanks for the reply 👍🏽

I reproduce this modification, and it works very well

thanks again 🙂

@cure53
Copy link
Owner

cure53 commented May 27, 2024

Cool, we say thanks!

@cure53 cure53 closed this as completed May 27, 2024
@HakumenNC
Copy link
Author

HakumenNC commented Jun 10, 2024

Hi,

Thanks for the new release.
Can you make the same fix on 2.X branch or do you prefer i create a new issue for this?

cure53 added a commit that referenced this issue Jun 10, 2024
fix: Added right browser dist path for 2.x as well
@cure53
Copy link
Owner

cure53 commented Jun 10, 2024

Aye, sorry - this is now fixed 😄

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

No branches or pull requests

2 participants