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
Then run npm start and it will throw something like
ReferenceError: fetch is not defined
at Choo.view [as _handler] (/home/yerko/Dev/choo-talk/views/main.js:8:5)
at Choo._prerender (/home/yerko/Dev/choo-talk/node_modules/choo/index.js:235:18)
at Choo.toString (/home/yerko/Dev/choo-talk/node_modules/choo/index.js:209:19)
at Object.module.exports.render (/home/yerko/Dev/choo-talk/node_modules/bankai/ssr/choo.js:66:7)
at ServerRender.render (/home/yerko/Dev/choo-talk/node_modules/bankai/ssr/index.js:28:39)
at Array.renderApp (/home/yerko/Dev/choo-talk/node_modules/bankai/lib/graph-document.js:54:11)
at module.exports (/home/yerko/Dev/choo-talk/node_modules/run-waterfall/index.js:24:13)
at documentifyRoute (/home/yerko/Dev/choo-talk/node_modules/bankai/lib/graph-document.js:47:5)
at push (/home/yerko/Dev/choo-talk/node_modules/map-limit/index.js:46:5)
at flush (/home/yerko/Dev/choo-talk/node_modules/map-limit/index.js:32:7)
The text was updated successfully, but these errors were encountered:
This happens because bankai tries to server render when you do module.exports = app.mount('body'). When server rendering it enters your view function and tries to fetch, but fetch doesn't exist in node.
Hmm maybe in Bankai we can use https://www.npmjs.com/package/globals to check if an error message is for an undefined browser global and show a more helpful message about SSR.
Expected behavior
module.exports = app.mount('body')
should work on the browser, with browsers APIsActual behavior
Using fetch ends up in
fetch is not defined error
which dissappears when I changemodule.exports = app.mount('body')
withapp.mount('body')
Steps to reproduce behavior
Run
npx create-choo-app some-app
and replace the main view withThen run
npm start
and it will throw something likeThe text was updated successfully, but these errors were encountered: