apostrophecms / sanitize-html

Clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis. Built on htmlparser2 for speed and tolerance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Distribute package as an es5 module

Matt-Butler opened this issue · comments

The problem to solve

Is your feature request related to a problem you are experiencing that is not a bug? Please describe.

Sanitize-html is currently only distributed as an es6 module. Most build systems by default will not transpile dependencies in the node_modules directory. I would like to consume this library as an es5 module so my application does not need to transpile sanitize-html.

Proposed solution

Add a build step to generate a lib directory with code distributed as es5.

Alternatives

Application could configure webpack or other build tools to transpile this code. However, I don't think this is a typically pattern. Transpiling downstream dependencies also requires more time and resources.

Additional context

I'm happy to make a contribution for this enhancement

We used to do this. It broke regularly and while we appreciated the community's contributions it was too difficult to provide timely fixes to something we didn't actually use in-house. This is an ES6 module.

Also, I'm wondering where the ES5 requirement is really coming from at this point, given that Microsoft has officially ended IE11.