-
Notifications
You must be signed in to change notification settings - Fork 13
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
Build error when using isomorphic-dompurify in angular 15 universal #203
Comments
Hi @praveshShetty, Thanks for reporting the issue. Unfortunately, the log doesn't say a lot. Could you please provide a sandbox project where I could reproduce the issue? |
What is your hosting environment? |
@kkomelin, I'm also seeing this error, but I have a bit more info relating to it. import DOMPurify from 'isomorphic-dompurify';
I'll update this comment with a minimal reproduction. |
Thanks @JeremyGuinn for the information. |
Here is a codesandbox that gets the same error when running dev:ssr |
Thanks @JeremyGuinn,
|
Yeah, I'm able to resolve this by using @angular-builders/custom-webpack, and using the same solution from #54 by adding the externals so webpack doesn't try to bundle them in the browser code. I've updated the codesandbox with this fix.
{
...
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"path": "./webpack.config.js"
},
...
},
...
},
...
"server": {
"builder": "@angular-builders/custom-webpack:server",
"options": {
"customWebpackConfig": {
"path": "./webpack.config.js"
},
...
},
...
},
...
},
...
}
module.exports = function(config) {
return {
...config,
externals: {
...config.externals,
canvas: 'commonjs canvas',
jsdom: 'commonjs jsdom'
}
}
} |
That's great news @JeremyGuinn. Thanks for sharing the working solution! My guess is you only need the proposed customization of the Webpack config for the server side (@angular-builders/custom-webpack:server). But I didn't try it myself. |
I'm trying to use isomorphic dompurify's sanitize function, in my angular application, which uses angular universal for server side rendering. While there is no error when running the application as a client side rendered one. server side rendering is not working.
I'm importing the sanitize function using ES6 syntax:
import { sanitize } from 'isomorphic-dompurify';
Is this a known issue.
I'm currently using
"angular" : 15.2.2
"typescript": "4.9.4"
"node" : 16.19.1
"isomorphic-dompurify": "^1.7.0"
The text was updated successfully, but these errors were encountered: