Installing third party NPM components


#1

Hi Help needed
When installing third party npm packages or more specific third party components like “vue-chessboard” or “vue-full-calendar” into my Meteor/Vue project, I keep getting the error: “ReferenceError: window is not defined”
I assume this occurs because the components imported is only client-side and the meteor server “are looking for a window” - BUT how do i deal with this in my project ?
Any one who want to take a shot - maybe try it - an come to help
Thanks


#2

A few options here, some better/cleaner than others.

  1. Don’t render these components on the server. Quick, but pretty undesirable.

  2. Look into what properties on the window are being utilized and stub them. Less quick, still pretty undesirable.

  3. Clone the package into your project and fix the issue. Quickest, and in my opinion best option. Plus you can open a pull request, potentially get it merged and helping untold numbers of other devs :grin: