DavidWells / DavidWells/analytics

ES5 build breaks violates CSP for unsafe-eval

Open
#192 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.7k
Forks
267
PR merge metrics
No merged PRs in 30d

Description

The current ES5-friendly build distributed through NPM breaks content security policies due to the reliance on regeneratorRuntime to replace async/await functions. This breaks chrome extensions, even those that follow the suggestions to set checkProtocolTask et al to null. Would it be possible to include two builds in the dist - one for modern browsers (e.g. es6+) and one for legacy browsers (e.g. es5)? This was the solution used by pdf.js:

https://github.com/mozilla/pdf.js/issues/11036#

image
image

this of course sources from the es5 build:

https://unpkg.com/browse/analytics@0.7.11/dist/analytics.js
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the NPM distribution, especially the ES5 build shown at dist/analytics.js, and trace how the build handles async/await and regeneratorRuntime. Compare the requested modern and legacy outputs with the pdf.js approach linked in the issue; done means the package includes separate builds and the modern build does not violate CSP through unsafe-eval.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.