Error encountered within the mounted hook in threejs referencing issue

After successfully importing a js file with three.js code into a standard HTML file, I attempted to export/import the code from the external JS file and call it from mounted. However, when doing so, I received an error message stating: "ReferenceError: THREE is not defined."

Here is a link to my code for reference:

https://i.sstatic.net/Os6Yf.png

This error appears to be a reference issue, similar to a missing package in Java. But why is it occurring if the 'package' is being used in the external JS file? And how can this be resolved?

Answer №1

The external JavaScript file was lacking the necessary imports

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Enhanced jQuery Pop-Up Panel

A few issues to address: 1) My goal is to optimize the efficiency of this script. 2) When a user clicks on either pop-out button, it opens a window and hides the element. (Currently using .detach() to remove the embedded video player because in Firefox . ...

Extract the property value and save it as an array in Vue

Looking to extract all values of a specific property and save them as an array. I attempted the following method: data() { return { roomList: null } }, methods: { getRooms() { var that = this axios.get('http://local ...

I require the use of Nodejs with the gm module to process images, but it is essential that it

There are two methods to consider, but I am struggling to make it synchronous. Despite attempting to use Promise.all to synchronize the process, I am faced with the challenge of images processing asynchronously and inability to reject or resolve in a loop. ...

Transforming JSON into array format with key-value pairs using JavaScript

Currently, I am working on a web application that is receiving data in a specific format from a node server: "{""elements":[{"10sr2b2":{"total":0,"bad":22,"clients":["fc8e7f","fc8e7e"],"zone":"101900"}}]}" The issue lies in the fact that this data is str ...

What could be causing the state object in React to not be updating correctly? There seems to be a discrepancy between the expanded and

Displayed on the console is a screenshot showing <br><br> I am working with React.js, and the object displayed in the image is an element within an array that is part of the state object. I'm puzzled by what's happening. The object a ...

Issue with Colorbox plugin preventing ASP.NET button from triggering postback

Currently utilizing the colorbox modal plugin (http://colorpowered.com/colorbox/) I'm facing an issue with a simple form placed in a master page - the submit button is unresponsive and doesn't trigger any action. It seems like several users are ...

Using Vue Js to conditionally disable updates to v-model

I need to update the v-model of the dropdown if it becomes disabled based on a condition. Specifically, I want to set my ir.IR_SectionId back to 0 when the select box is disabled. <select v-model="ir.IR_SectionId" v-default-value:ir.IR_SectionId="0" ...

Ways to modify the appearance of tiptap-vuetify

I have implemented tiptap-vuetify (available at https://github.com/iliyaZelenko/tiptap-vuetify) as my wysiwyg editor. However, I am not satisfied with the default styling. Since it does not accept class or style as props, I am looking for ways to customi ...

Having trouble establishing a connection with the OpenWeather API in your Javascript code

I'm trying to show the current weather conditions for the state I enter, but every time I do, it gives an error saying "wrong city name" and then shows as undefined. const button = document.querySelector('.button'); const inputValue = docume ...

What is the trick to positioning the dice above the green circle and below the line, as shown in the image?

I'm struggling to position the large green circle and the dice image on top of each other as well as below each other. How can I achieve the desired layout shown in this image? Here's what I have managed to do so far https://i.sstatic.net/ryIPl.p ...

Enhance your tooltip pie chart in echarts4r by incorporating additional variables

Currently, I am in the process of creating a doughnut chart with echarts4r. As I delve into adding a custom tooltip to enhance the user experience, I have successfully referenced examples from Stack Overflow on stacked area charts (Echarts4r : Create stack ...

I'm puzzled as to why I have to encode the path parameter twice in order for the REST call to properly handle special characters

I have a challenge with a REST call that fetches a product's ingredients using the product name as the path variable. I allow for any character to be used, and I know I need to use encodeURIComponent(name) to encode characters such as "/" to prevent m ...

Incorporating a helper JavaScript file to seamlessly integrate Typeform into a project built with Vue

Struggling with incorporating a typeform into my website through the use of both vue and laravel. The problem arises when trying to embed the typeform using a script, as Vue throws an error when attempting to include the script directly within the compone ...

Retrieve state in React without explicitly referring to it

let x = this.state.x; //initialized in the constructor: {number: 1} console.log(x); //Displays: {number: 1} x.number = 2; console.log(this.state.x); //Displays: {number: 2} Is there a way to modify x without affecting the value of state.x as a referen ...

Unable to retrieve dynamically generated object property from an array in AngularJS 2+

Here is an example of an items array: this.itemList = [ { id: 1, name: 'a', address: 'as dasf a' }, { id: 2, name: 'b', address: 'as dasf a' }, { id: 3, name: 'c', address: 'as dasf a' } ]; ...

Time taken to execute all the tests using the karma runner

We have recently transitioned to running unit tests remotely using browserstack across multiple browsers and operating systems with the help of the karma-browserstack-launcher plugin. The current output of our test run appears as follows: $ grunt unit:re ...

Adding and deleting MPEG-DASH segments from a media source buffer in a dynamic manner

I have been developing a custom MPEG-DASH streaming player using the HTML5 video element. Essentially, I am setting up a MediaSource and attaching a SourceBuffer to it. After that, I am appending DASH fragments into this sourcebuffer and everything is func ...

Ways to identify the visible elements on a webpage using JavaScript

I'm working on a nextjs app , I am looking to dynamically update the active button in the navbar based on which section is currently visible on the page. The child elements of the page are structured like this: <div id="section1" > < ...

To modify the text within the pagination select box in ANTD, follow these steps:

Is it possible to modify the text within the ant design pagination select component? I have not been able to find a solution in the documentation. I specifically want to replace the word "page" with another term: https://i.sstatic.net/w55hf.png ...

Why does the node.js app only run from the command prompt and not directly?

I have a basic vbscript that launches two nodejs apps necessary for my server's operations. Dim objShell Set objShell = Wscript.CreateObject("WScript.Shell") objShell.Run "node C:\!webroot\site.name\server\pubsub.js" objShell.Run ...