LeaVerou / prefixfree

Break free from CSS prefix hell!
http://projects.verou.me/prefixfree/
MIT License
3.83k stars 712 forks source link

Document.currentScript is null when executed in a module or with eval #6149

Open TrevorKarjanis opened 4 years ago

TrevorKarjanis commented 4 years ago

Document.currentScript is null when executed in a module or with eval. This results in an exception on line 14 in prefixfree.js. I understand that the limitations state, "Prefixing code in @import-ed files is not supported." However, I am not sure if that refers to the CSS or the -prefixfree source. Applications run in environments like StackBlitz are bundled or executed with eval where Document.currentScript is always null. This reproduction using -prefixfree and conic-gradients performs a null check.

var currentScript = document.currentScript;
var self = window.StyleFix = {
    optIn: currentScript && currentScript.hasAttribute("data-prefix"),

v1.0.10