mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: make Node.js environment detection robust w.r.t. JSDOM (#6148)
Previously Node.js was detected by the lack of `global.document` which doesn’t work in case JSDOM is being used in Node.js. Instead, we now detect `process.versions.node`, like here: 426943ae93 (diff-168726dbe96b3ce427e7fedce31bb0bc)
.
Fixes #6147.
This commit is contained in:
parent
054fa2e45d
commit
aee8fda98a
@ -14,4 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const isNode = typeof document === 'undefined';
|
export const isNode = !!(
|
||||||
|
typeof process !== 'undefined' &&
|
||||||
|
process.versions &&
|
||||||
|
process.versions.node
|
||||||
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user