Skip to content

Commit

Permalink
Try to reproduce dompurify build warning from cure53/DOMPurify#705
Browse files Browse the repository at this point in the history
  • Loading branch information
amdw committed Aug 11, 2022
1 parent ab2254d commit ba285f6
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
3 changes: 1 addition & 2 deletions angular.json
Expand Up @@ -33,8 +33,7 @@
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true,
"allowedCommonJsDependencies": ["dompurify"]
"namedChunks": true
},
"configurations": {
"production": {
Expand Down
11 changes: 11 additions & 0 deletions dompurify.patch
@@ -0,0 +1,11 @@
--- node_modules/dompurify/package.json.old 2022-08-11 10:15:37.122839016 +0100
+++ node_modules/dompurify/package.json 2022-08-11 10:15:53.130662100 +0100
@@ -17,7 +17,7 @@
"test:ci": "cross-env NODE_ENV=test BABEL_ENV=rollup npm run test:jsdom && npm run test:karma -- --log-level error --reporters dots --single-run --shouldTestOnBrowserStack=\"${TEST_BROWSERSTACK}\" --shouldProbeOnly=\"${TEST_PROBE_ONLY}\"",
"test": "cross-env NODE_ENV=test BABEL_ENV=rollup npm run lint && npm run test:jsdom && npm run test:karma -- --browsers Chrome"
},
- "main": "dist/purify.cjs.js",
+ "main": "dist/purify.es.js",
"module": "dist/purify.es.js",
"browser": "dist/purify.js",
"files": [
10 changes: 10 additions & 0 deletions dompurify_repro.sh
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

(cd node_modules/dompurify && npx -p typescript tsc dist/*.js --declaration --allowJs --emitDeclarationOnly --outDir dist)

patch -u node_modules/dompurify/package.json -i dompurify.patch

npx ng build --configuration production | grep dompurify

2 changes: 1 addition & 1 deletion src/app/markdown/markdownify.pipe.ts
Expand Up @@ -15,7 +15,7 @@
*/

import { Pipe, PipeTransform } from '@angular/core';
import * as DOMPurify from 'dompurify';
import DOMPurify from 'dompurify';
import snarkdown from 'snarkdown';

@Pipe({
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Expand Up @@ -16,7 +16,8 @@
"importHelpers": true,
"target": "es2020",
"module": "es2020",
"lib": ["es2018", "dom"]
"lib": ["es2018", "dom"],
"traceResolution": true
},
"angularCompilerOptions": {
"strictInjectionParameters": true,
Expand Down

0 comments on commit ba285f6

Please sign in to comment.