Having trouble loading three.js animations after deploying it to Github

I created a simple portfolio website using the main.js file. It functions properly when viewed on my local server, but once I upload the code to GitHub and deploy it, the JavaScript files don't seem to load.

Although I can see the HTML and CSS files, the main.js file fails to load. I attempted different solutions such as using gh-pages and creating a dist folder, but unfortunately, none of them worked.

The console is displaying the following error message:

THREE.WebGLRenderer: A WebGL context could not be created.

Any suggestions on how I can resolve this issue? Feel free to check out my code.

Answer №1

<script type="module" crossorigin src="/assets/index.548483ff.js"></script>
<link rel="stylesheet" href="/assets/index.4db4f50e.css">

Both URLs are incorrect. It is recommended to use:

<script type="module" crossorigin src="./assets/index.548483ff.js"></script>
<link rel="stylesheet" href="./assets/index.4db4f50e.css">

By adding a dot before the slash, it ensures that the path starts relative from the current location and not from the host.

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

Adjust the size of an image within a canvas while maintaining its resolution

My current project involves using a canvas to resize images client-side before uploading to the server. maxWidth = 500; maxHeight = 500; //handle resizing if (image.width >= image.height) { var ratio = 1 / (image.width / maxWidth); } else { var ...

The parameter string could not be transmitted via XMLHttpRequest

Hello, I'm currently facing an issue with sending request parameters through the XMLHttpRequest.send(params) method when trying to get a response from a Web Service. The request parameters seem to not be getting sent properly. Below is the code snipp ...

Can you please explain the steps to retain the custom date picker settings even after closing the app?

I am working on developing a straightforward d-day app. Currently, the code I have resets the date selected in the date picker upon quitting and restarting the application. I would like to enhance the functionality so that the date picker retains user se ...

What is the best way to organize a column in a table to prevent the display of duplicate values in React?

As I work on managing teams for an alumni group's webpage, I have a table with fields such as year, team category (Football, etc), and members (many-to-many relationship). My goal is to display a list of categories on the main page, with each category ...

Choose an option using jQuery with the ability to navigate to the previous or next

I encountered a bug when I tried to click the next or previous button. Below is the HTML code snippet: $("#nextPage").click(function() { $('#pagination option:selected').next().attr('selected', 'selected'); console.log( ...

using spread operator to extract properties from API response objects

Currently undergoing a React/Next course, we recently had to retrieve data from an API that returns a list of objects containing information to populate the page. This task was accomplished using Next's getStaticProps method, passing the data to the ...

To display the elements of an array in a dropdown menu

I have a collection of arrays within an object. {"ItemIsExportControlled":["true","false"],"OrderShippingDestination":["domestic","foreign"],"OrderShipping":["ground","air","sea"],"ItemStockStatus":["validInStock","invalid","validOutOfStock"],"OrderDelive ...

Error encountered: The function 'showErrorMessage' is not exported from the file '../helpers/alerts'

Within the directory ../helpers/alerts, there is a file called alerts.js const displaySuccessMessage = (success) => { <div className="alert alert-success">{success}</div> } const displayErrorMessage = (error) => { <di ...

Ensure accurate detection of invalid values for SVG Elements in React using jest testing framework

When testing my react app, I am attempting to capture any errors that are thrown or logged to the console. If a regular HTML element such as <p> contains invalid attributes like <p color={false}></p>, react will display an error via cons ...

Failure of window marker to trigger click event in jquery-bing-maps

I'm encountering an issue where clicking on links within Window markers on Bing Maps redirects me to a new page instead of triggering a JavaScript event as intended. $('.single_address').on('click', function (evt) { alert(&apo ...

External javascript file not providing accurate data for Google Analytics tracking

Our Google Analytics account shows that we are receiving data. I uploaded to our Alpha site here on Monday and have only seen 1 visit on the 19th so far, with no activity for the rest of the week. Despite having visitors from other offices and states, the ...

Can someone please explain how I can implement a multi-submenu feature using JavaScript?

HTML CODES: <header> <nav> <ul> <li class="asmenu"><a href="#">Menu1 <i class="fa fa-caret-down"></i></a> <ul class="submenu deact ...

Is there a way for me to include BufferGeometryUtils.js into three.d.ts declaration file?

I have come across BufferGeometryUtils in the example directory of three.js, which allows for converting existing geometries to buffer geometry without the need to refactor all my code for performance improvement. I am wondering how I can declare this fu ...

`The value of an array containing specific class elements is lost when accessed within a setTimeout

I've come across an issue while using a JavaScript file to hide several divs all sharing the same class name. The program successfully hides the divs, but when I try to make them visible again after a certain number of seconds, the array of elements b ...

The submission process continues to load indefinitely without displaying any data

I have set up a donation form where the user can submit their donation. The issue I am facing is that, although the data is being updated in the backend and stored in the database correctly, the AJAX request is not receiving the return data. I have a loade ...

Using one payload.js file for all Nuxt static generated routes with identical data

I am facing a challenge with my NuxtJS site where I have only one page /pages/matrix/index.vue but numerous dynamic routes pointing to this page, all utilizing the same data set. During static build generation for deployment on Netlify, the size of the dis ...

While attempting to make my div responsive, it unexpectedly became stuck to the navbar

After successfully creating a website that works fine on desktop, I encountered an issue when viewing it on my phone. The main content section, which features jokes, gets scrolled up along with the navbar. I followed a tutorial on YouTube to make the navba ...

Retrieving InnerHTML of a Rendered DOM Element in AngularJS

Can I retrieve the innerHTML code of a rendered element that contains an ng-repeat loop? Here is an example: <div id="container"> <div ng-repeat="e in ctrl.elements>{{e.name}}</div> </div> ...

When attempting to compile Angular in production mode, errors may arise such as the Uncaught SyntaxError caused by an Unexpected token '<'

I encountered some errors in the console of my Angular 8 app. When I opened the browser window, it was blank and this error appeared: Uncaught SyntaxError: Unexpected token '<' https://i.sstatic.net/a16DD.png I tried running different ng bui ...

Is there a way to access the pixel data of a scene in Three.js without having to render it on the canvas?

Is there a way to obtain the pixel data (in the form of an array buffer) that would be displayed on a canvas if I were to render a scene, without actually rendering it on the canvas? If so, how can this be achieved? I have not written any code for this ye ...