Skip to content

Commit

Permalink
add node-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobrosenberg committed Jan 30, 2020
1 parent 5fc7857 commit 65e18de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"bufferutil": "^4.0.1",
"canvas": "git+https://github.com/sveltech/dummy-module.git",
"jsdom": "^16.0.1",
"node-fetch": "^2.6.0",
"utf-8-validate": "^5.0.2"
}
}
2 changes: 2 additions & 0 deletions ssr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { JSDOM } = require('jsdom')
const fs = require('fs')
const fetch = require('node-fetch')

const defaults = {
host: 'http://jsdom.ssr',
Expand All @@ -20,6 +21,7 @@ module.exports.ssr = async function ssr(template, script, url, options) {
try {
const dom = await new JSDOM(template, { runScripts: "outside-only", url: host + url })
dom.window.requestAnimationFrame = () => { }
dom.window.fetch = fetch
dom.window.addEventListener(eventName, async () => {
afterEval(dom)
const html = dom.serialize()
Expand Down

0 comments on commit 65e18de

Please sign in to comment.