Sharing my experience with a similar issue, I recently stumbled upon this project and was intrigued by its functionality. Upon further investigation, I discovered that it is configured as a Single Page Application (SPA). Implementing the same approach in my own project proved successful.
In the context of nuxt.config.js
export default {
mode: "spa",
..
Hence, the root of the problem seems to lie in server-side rendering.
------ Insights on Universal Mode ------
Striving to utilize my application in universal mode, I experimented with conditionally importing plugins. However, it's worth noting that the following method did not yield the desired outcome. Nonetheless, I include it here for reference purposes, as SPA may not be a viable solution and could potentially guide you towards a resolution.
Relocate
import Vue from 'vue'
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls"
Vue.use(OrbitControls)
to a threeimports.js file within the plugins directory and append
plugins: [
{ src :"~/plugins/threeimports.js", ssr: false},
..
into the nuxt.config.js
Although I expected OrbitControls to be accessible throughout the project, this was not the case. The issue appears to stem from the curly bracket syntax, as other modules lacking this syntax function seamlessly using the same method.