vue-threejs icon indicating copy to clipboard operation
vue-threejs copied to clipboard

ReferenceError: window is not defined

Open ryanrca opened this issue 6 years ago • 1 comments

ReferenceError window is not defined

All I did was import the library:

<script>
import VueThreejs from 'vue-threejs';
export default {};
</script>

Refresh the page, get that error. Stack trace is crashing on window.webkitRequestAnimationFrame...:

};

function requestAnimationFrame(callback) {
  setTimeout(callback, 1000 / 60);
}
var requestAnimationFrame$1 = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || requestAnimationFrame;

var CenteredDiv = function () {
  function CenteredDiv() {
    classCallCheck(this, CenteredDiv);
    this.backgroundElement = document.createElement('div');
     

Maybe this library has issues working with nuxt.js? https://stackoverflow.com/questions/40707481/window-is-not-defined-in-vue-js-2

ryanrca avatar Oct 11 '19 02:10 ryanrca

@ryanrca oh yes, didn't adapt it to nuxt.js yet

maybe try to wrap the <script> in a <client-only> or sth else?

fritx avatar Oct 12 '19 08:10 fritx