NetanelBasal/nb-choices

Issues when trying to serve via SSR

astr0sl0th opened this issue · 0 comments

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request

Current behavior

When building for your app to be rendered server side using Angular Universal nb-choices imports the choices.js lib into the built server.js file which causes an error since there are calls to the document (possibly window too) which aren't supported in node.

Expected behavior

Should only load choices.js client side as needed

Minimal reproduction of the problem with instructions

ng add @nguniversal/express-engine --clientProject your-project
npm run build:ssr && npm run serve:ssr

What is the motivation / use case for changing the behavior?

So you can use this lib when rendering your app on the server

Environment


Angular version: 8.02


Browser:
- [x] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
Others: