-
-
Notifications
You must be signed in to change notification settings - Fork 691
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
[bug] - Build error in angular app #895
Comments
Oha, we didn't change much that might impact how to import the library, do you have more info per chance? |
Maybe the changes done in early November are the culprit? cc @ssi02014 |
I have same issue using React |
I have the same issue using LIT. This is the error message i get: Import "sanitize" will always be undefined because there is no matching export in "../../node_modules/dompurify/dist/purify.es.mjs" [import-is-undefined] |
@ssi02014 If possible, please have a look. I am pretty sure this is because of the changes in November: |
Also getting this error once my app updated from 3.0.6 -> 3.0.7 |
@cure53 Currently, purfiy is exporting via |
@ssi02014 I have the issue importing with |
import DOMPurify from 'dompurify' Do you get an error if you do the above? |
Either way we need a fix that makes things work for everyone who uses the ways described above (i.e. not break things). I am happy to release a 3.0.8 once this is sorted. I cannot do much here myself, but I presume it's a quick fix after all 😄 |
@mathiasdeoliveira @Justxs @pauly92 @CaptainGlac1er This PR should fix the issue, please check if possible if this does the trick indeed. If so, we will release 3.0.8 tomorrow. Thanks @ssi02014 for the super-fast reaction! |
@ssi02014 this is probably why I didn't use that approach. |
@cure53 also ccing you on this ^ |
This might be helpful. Are The Types Wrong? is reporting that the ESM export is "Masquerading as CJS". https://arethetypeswrong.github.io/?p=dompurify%403.0.7
|
When I tested,
|
I have the same problem in Angular with Slickgrid/node_modules/@types/dompurify/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flag
7 import DOMPurify from 'dompurify';
~~~~~~~~~
node_modules/@types/dompurify/index.d.ts:4:1
4 export = DOMPurify;
~~~~~~~~~~~~~~~~~~~
This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag. if I remove So I wonder if there's a problem with |
Thanks, @ghiscoding and @ssi02014 - I am unsure now, shall we go with the given PR or file a PR against |
i have issue in react v18 codebase (CRA) - webpack wont build; i have only available "@types/dompurify": "3.0.5", |
The revert of all the exports will probably (hopefully) help, I think that I would give that a try so that we can still EDIT I tried manually by removing Note, for anyone who wants to try manually in Angular, you need to make sure to delete the |
This release should fix it: https://github.com/cure53/DOMPurify/releases/tag/3.0.8 |
It seems to be working fine, thanks! 🤗 @cure53 @ghiscoding @mathiasdeoliveira |
I also confirmed that my CI build is now working, this issue could probably be closed since it was for Angular and I just confirmed that it works in Angular. Thanks for this great project and the quick turnaround with a fix 👍🏻 |
Awesome, phew ❤️ Glad to hear it worked! |
[bug] - Build error in angular app since your last version 3.0.7
Error: export 'sanitize' (imported as 'DOMPurify') was not found in 'dompurify' (possible exports: default)
Background & Context
We use your library with Angular version 15 and dompurify import in non-fixed mode.
package.json
"dompurify: "^3.0.6",
and import like this into the typescript file
import * as DOMPurify from 'dompurify';
Temporary solution :
use fixed version "dompurify: "3.0.6"
The text was updated successfully, but these errors were encountered: