ssr-polyfill 👋
fake browser runtime environment in server-side render.
Homepage
🏠Install
npm install ssr-polyfill --save# or yarn add ssr-polyfill
Usage
in node env:
const ssrPolyfill = ;globalwindow = ;globalself = globalwindow;// maybe you can mock somewhere// not use `window.document` use `document.*`globaldocument = globalwindowdocument;// in client env `window.context` is { userInfo: 'hello' }
url
default ishttp://localhost
, you also change thelocation.pathname
usehttp://localhost/bar
html
init html template, default is<body><div id="root"></div></body>
- other params will mount in
window
object
Run tests
npm run test
Author
- Github: @ycjcl868
🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Show your support
Give a ⭐️ if this project helped you!
📝 License
This project is ISC licensed.