You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ionic.core.js files, as well as ionicons.core.js files use the line new Function("w","return class extends w.HTMLElement{}") which causes EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src"
This looks like it comes from ES5 backwards compatibility. There should be an option to not include ES5 if needed. There is the option in the angular.json, but that doesn't seem to work to remove this "es5BrowserSupport": false
Expected behavior:
All unsafe evals should be removed to allow ionic to run in environments with strict CSP.
Steps to reproduce:
Generate a new ionic application
Related code:
var e;
! function r(n) {
return /\{\s*\[native code\]\s*\}/.test("" + n)
}(n.customElements.define) ? (e = function(t) {
return n.HTMLElement.call(this, t)
}).prototype = Object.create(n.HTMLElement.prototype, {
constructor: {
value: e,
configurable: !0
}
}): e = new Function("w", "return class extends w.HTMLElement{}")(n), U[s].u(function i(n) {
var t = C(n),
e = t.s,
r = d(n[0]);
return t.s = function(n) {
var t = n.mode,
i = n.scoped;
return function o(n, t, e) {
return __webpack_require__("./node_modules/@ionic/core/dist/esm/es5/build lazy recursive ^\\.\\/.*\\.entry\\.js$ include: \\.entry\\.js$")("./" + n + (t ? ".sc" : "") + ".entry.js").then(function(n) {
return n[e]
})
}("string" == typeof e ? e : e[t], i, r)
}, t
}(t), e)
Related issue from Angular which was fixed in angular's core when using AOT, but this still is present in Ionic even when using AOT. angular/angular-cli#6872
Thanks for the issue. I am going to close this as it has been marked as fixed with the Stencil One refactor. If you are still experiencing this behavior please open a new issue. Thanks!
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Bug Report
Ionic version:
[x] 4.x
Current behavior:
The ionic.core.js files, as well as ionicons.core.js files use the line new Function("w","return class extends w.HTMLElement{}") which causes EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src"
This looks like it comes from ES5 backwards compatibility. There should be an option to not include ES5 if needed. There is the option in the angular.json, but that doesn't seem to work to remove this
"es5BrowserSupport": false
Expected behavior:
All unsafe evals should be removed to allow ionic to run in environments with strict CSP.
Steps to reproduce:
Generate a new ionic application
Related code:
Other information:
Ionic info:
The text was updated successfully, but these errors were encountered: