Closed housseindjirdeh closed 4 years ago
Looks great! Hopefully, we can re-add this in the future. In my mind, this'll bump things to a new major version.
Thanks for taking care of it, @housseindjirdeh.
Apologies for resurrecting this PR, but one potential way to detect CRA is by combining a check for their near-universally-kept <noscript>
and a React root. The noscript tag has been included with the same text since 2017.
'Create React App': {
id: 'create-react-app',
icon: 'cra',
url: 'https://create-react-app.dev/',
npm: 'react-scripts',
test: async function (win) {
let child = win.document.body.firstElementChild;
let noscript, root;
do {
if (child.localName === 'noscript') noscript = child;
else if (child.id === 'root') root = child;
} while (child = child.nextElementSibling);
if (root && noscript && /You need to enable JavaScript to run this app/.test(noscript.textContent)) {
return { version: UNKNOWN_VERSION };
}
}
},
Thanks @developit! I've been staying away from only using their specific noscript tag but if we couple that with a React root I think that could be pretty fool-proof to a degree :)
@johnmichel What do you think? If you're okay with it, I'll put up a PR and bump to a new major version!
Only if you think it's close enough. I figured checking the exact text of the noscript will make this likely to be biased towards false negatives, which is probably okay.
Looks great! Thanks, @developit and @housseindjirdeh
Since there's no easy way to detect Create React App on a page, this implementation requested for an
asset-manifest.json
file that would break auth flows in some sites (e.g. Bitbucket)Until we find a viable solution, it's probably safest to remove entirely 😞