Static GitHub Issues

[30] 'Window is not defined' where do I put client-side only scripts?

prev: How can I use webpack.ProvidePlugin ?
next: Translation support (or get access to Vue configuration)

I'm trying to run a-frame in one of my vue pages but I'm getting an error in my browser: ReferenceError: window is not defined

I'm guessing this is because nuxt is trying to run the aframe module while rendering the page on the server.

<template>
    <div>
        <a-scene fog="type: linear; color: #FFEBDE; far:190"  debug>
            <a-entity>
                <a-collada-model src="/obj/banner.dae"></a-collada-model>
                <a-ring color="teal" radius-inner="1" radius-outer="2"></a-ring>
            </a-entity>

            <a-entity position="0 -1 10">
                <a-camera>
                    <a-cursor color="#2E3A87"></a-cursor>
                </a-camera>
            </a-entity>
            <a-entity camera="userHeight: 1.6" look-controls></a-entity>
        </a-scene>
    </div>
</template>

<script>
import 'aframe';

export default {
    mounted() {

    }
}
</script>
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c30">#c30</a>)</em></sub></div>