Angular OnInit HttpClient GET Request Returns Different Data than jQuery AJAX for the Same Endpoint

I am encountering an issue with Angular’s HttpClient where a GET request to my server returns different data compared to a jQuery AJAX request for the same endpoint. I am using Flask for my backend, with CORS: CORS(app, supports_credentials=True). It currently works for POST requests (for sign in and sign out).

Problem Description:
When I make a GET request to my Flask server using jQuery AJAX, everything works as expected, and I receive the correct user information. However, when I attempt the same GET request using Angular’s HttpClient, I receive a response indicating that the user is not authenticated ({“is_authenticated”: False}), even though the user is authenticated.

Here is the working jQuery AJAX code:

$(document).ready(function() {
    fetchPlayerInfo();
});

function fetchPlayerInfo() {
    $.ajax({
        type: "GET",
        url: "http://localhost:5000/api/player/info",
        xhrFields: {
           withCredentials: true
        },
        crossDomain: true,
        success: function(response) {
            console.log("Fetch player info successful:", response);
        },
        error: function(response) {
            console.log("Fetch player info failed:", response);
        }
    });
}

And here is my Angular code that is not working as expected:

import { Component, OnInit } from '@angular/core';
import { HttpClient } from "@angular/common/http";

@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrl: './header.component.scss'
})
export class HeaderComponent implements OnInit {
  private baseUrl = 'http://localhost:5000/api';

  constructor(private http: HttpClient) {}

  ngOnInit() {
    const url = `${this.baseUrl}/player/info`;
    this.http.get<any>(url, {withCredentials: true}).subscribe((data) => {
      console.log('UserInfo:', data);
    });
  }
}

My backend is in Flask. Here is the relevant router endpoint:

@player_bp.route('/info', methods=['GET'])
def get_player_info():
    print("Session: ", dict(session))
    print("Current User: ", current_user)
    if current_user.is_authenticated:
        player_info = {"is_authenticated": True, "name": current_user.name}
    else:
        player_info = {"is_authenticated": False}
    return jsonify(player_info)
    

Additional Observations:

  • The issue only occurs when the Angular HttpClient request is made in the ngOnInit lifecycle hook.
  • If I trigger the same HTTP request through an Angular event handler (e.g., by clicking a button), it works correctly, similar to the jQuery AJAX request.
  • This behavior leads me to believe that the problem might be related to the timing of the HTTP request or the management of the authentication state during the component’s initialization.

Why is Angular’s HttpClient not returning the correct data when the request is made in the ngOnInit lifecycle hook? Should I just drop Angular?

localStorage.getItem() returns an old value

Local storage has always been working completely fine since I started using it. There have been no real problems with data saving and manipulation. However, recently the getItem() method has been returning a random old value. It always returns the same one.

I know this is not an issue with the setItem() method because I have looked in devtools and it is writing the correct value. I have tried setting a large setTimeout to my save reading function but to no avail. I have spent over an hour on this issue with little progress.

javascript : Ask for guidelines on writing code Leave system [closed]

Business starts Monday to Friday.
Work starts at 8:30 a.m. and finishes at 4:30 p.m.
And there are other holidays as customized.

Demand conditions

Calculate leave days By counting work hours from 8.30 – 16.30 according to business conditions. and skip counting holidays

example
Leave begins on 2024-01-02 at 2:30 p.m. and ends on 2024-01-05 at 12:30.
And the company has designated the 3rd day as a holiday.
The system must calculate the value as follows.

  • Day 2, number of leave hours is 2 hours.
  • Day 3, holiday
  • Day 4, number of leave hours is 8 hours.
  • On the 5th day, the number of leave hours is 4 hours.
  • Summary of total leave of 14 hours

Please help suggest guidelines for writing code or examples.

function calculateLeaveHours(startDate, startTime, endDate, endTime, holidays) {
  const workStartTime = new Date();
  workStartTime.setHours(8, 30, 0, 0);

  const workEndTime = new Date();
  workEndTime.setHours(16, 30, 0, 0);

  const startDateTime = new Date(`${startDate}T${startTime}`);
  const endDateTime = new Date(`${endDate}T${endTime}`);

  let totalLeaveHours = 0;
  let currentDateTime = new Date(startDateTime);

  while (currentDateTime < endDateTime) {
    const currentHour = currentDateTime.getHours();

    if (
      currentHour >= workStartTime.getHours() &&
      currentHour <= workEndTime.getHours() &&
      !isHoliday(currentDateTime, holidays)
    ) {
      totalLeaveHours++;
    }

    currentDateTime.setHours(currentHour + 1);
  }

  return totalLeaveHours;
}

function isHoliday(date, holidays) {
  const dateString = date.toISOString().split('T')[0];
  return holidays.includes(dateString);
}

// Example usage:
const startDate = '2024-01-02';
const startTime = '08:30';
const endDate = '2024-01-05';
const endTime = '16:30';
const holidays = ['2024-01-03'];

const totalLeaveHours = calculateLeaveHours(startDate, startTime, endDate, endTime, holidays);

console.log(`Total leave hours: ${totalLeaveHours}`);

Total leave hours 26 But the answer must be 24
Which line of code should I edit or look at?

IOS 16 auto scroll to top when open page in safari UI webview

I have an chat app use in web page built by laravel + Vue2. Now i have a problem with IOS 16 and below. When i open this page or send message with safari it always scroll top a bit. When i test it in iphone IOS 17 or android device i don’t have this bug.

Does anyone have a problem like me?

  • When i try to set div ( content-detail ) from overflow:scroll to overflow-y:hidden, it’s pretty sroll to bottom but i cant scroll anymore

https://i.stack.imgur.com/YC6Hn.png

  • I used to do something like this:

div class=”content-detail” :class=”overflowY: scrollAble” ref=”content” @scroll=”handleScroll”>

            ...

/div>

and set scrollAble to true at created() but it’s still scroll to top when i open this page

Do I have to install tailwindcss-animate for data-[state=open]:animate-in to work?

I copied the dialog ui component from shadcn/ui. And the custom close button example:

import { Copy } from "lucide-react"

import { Button } from "@/components/ui/button"
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"

export function DialogCloseButton() {
  return (
    <Dialog>
      <DialogTrigger asChild>
        <Button variant="outline">Share</Button>
      </DialogTrigger>
      <DialogContent className="sm:max-w-md">
        <DialogHeader>
          <DialogTitle>Share link</DialogTitle>
          <DialogDescription>
            Anyone who has this link will be able to view this.
          </DialogDescription>
        </DialogHeader>
        <div className="flex items-center space-x-2">
          <div className="grid flex-1 gap-2">
            <Label htmlFor="link" className="sr-only">
              Link
            </Label>
            <Input
              id="link"
              defaultValue="https://ui.shadcn.com/docs/installation"
              readOnly
            />
          </div>
          <Button type="submit" size="sm" className="px-3">
            <span className="sr-only">Copy</span>
            <Copy className="h-4 w-4" />
          </Button>
        </div>
        <DialogFooter className="sm:justify-start">
          <DialogClose asChild>
            <Button type="button" variant="secondary">
              Close
            </Button>
          </DialogClose>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  )
}

The docs says nothing about installing tailwindcss-animate, so I assumed the data-[state=open]:animate-in and data-[state=closed]:animate-out would work out of the box. But no, I don’t see any animations.

Do I have to install tailwindcss-animate or I’m missing something else?

Function is not running as expected [duplicate]

I am a total novice with zero background in computer coding, teaching myself how to write code. I would be so grateful if someone who actually knows what they’re doing would please be able to explain why my code below isn’t working? Don’t give me the solution, please. I want to know the reason why it’s not doing what I expect it to do. Thank you so much in advance!

function getComputerChoice() {
  return rock || paper || scissors, Math.floor(Math.random() * 3);
  let rock = 0
  let paper = 1
  let scissors = 2
  if (0) {
    return "rock"
  } else if (1) {
    return "paper"
  } else {
    return "scissors"
  }
}

I tried what I included above and I expected the log to bring up either rock, paper, or scissors but it’s only bringing up the random number! I tried moving the variables to the beginning of the code but that made no difference in the results.

How to insert this JavaScript into my Quarto document?

I am experimenting with passing information back and forth between html widgets, but I don’t know what I’m doing.

I am using one function Reactable.onStateChange from this documentation:

https://glin.github.io/reactable/articles/javascript-api.html

This document renders but if I go into the browser tools, I see this error:

Uncaught Error: reactable instance 'myTable' not found
    at _i (reactable_state_change.html:4792:124046)
    at Object.rl [as onStateChange] (reactable_state_change.html:4792:124866)
    at reactable_state_change.html:4812:19
_i @ reactable_state_change.html:4792
rl @ reactable_state_change.html:4792
(anonymous) @ reactable_state_change.html:4812

I have tried to include the JavaScript in both the same chunk as the other widgets and also in a js chunk, but neither worked.

---
format: html
editor: source
self-contained: true
execute:
  echo: false
---

```{r}
#| message: false
library(reactable)
library(htmltools)
```

```{r}
dat <- data.frame(a = 1:5, b = 11:15)
tab <- reactable(dat, selection = "single", elementId = "myTable")
txt <- withTags(p(id = "mySelection"))
js <- tags$script(HTML(
  "Reactable.onStateChange('myTable', state => {document.getElementById('mySelection').innerHTML = state.selected})"
))
browsable(tagList(tab, txt, js))
```

```{js}
<!-- Reactable.onStateChange('myTable', state => {document.getElementById('mySelection').innerHTML = state.selected}) -->
```

The value of #results is printing as “undefined is a palindrome”, what’s going wrong with the JavaScript?

I’m relatively new to JavaScript and cannot identify the problem I’m having with displaying the correct text in the #results field and textInput picking up anything other than an undetermined value or “[object HTMLInputElement] is a palindrome”.

I’ve tried fixing it with several of the options found on here including using .toString(), .innerHTML vs .textContent, etc.

<!doctype html>
<html lang="en">

<head>
    <link rel="stylesheet" href="palindromeCheckerCSS.css" />
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootswatch/4.5.2/darkly/bootstrap.min.css">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap">
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Palindrome Checker</title>
</head>

<body>
    <div id="container">
        <h1>Palindrome Checker</h1>
        <input type="text" id="text-input" placeholder="Enter a word or phrase">
        <button onclick="checkPalindrome()" id="check-btn">Check</button>
        <div id="result"><h2 id="results"></h2></div>
        <div id="clear"><button onclick="clearText()" id="clear-btn">Clear</button></div>
    </div>
</body>
<script src="./palindromeCheckerJS.js">
    
let textInput = document.getElementById("text-input").toString();
const checkBtn = document.getElementById("check-btn");
const results = document.getElementById("results");
const clearBtn = document.getElementById("clear");

function checkPalindrome() {
    if (textInput.value === undefined) {
      alert("Please input a value");
  };

  const inputString = textInput?.toString().replace('"/,.-=+_][}{)(;:?><!@#$%^&* ').toLowerCase().value;
  const reversedString = textInput?.toString().split("").reverse().join("").value;

  if (inputString === reversedString) {
    results.innerHTML = `${textInput} is a palindrome`;
  } else {
    results.innerHTML = `${textInput} is not a palindrome`;
  };

  if (textInput = undefined) {
      alert("Please input a value");
  };
};

function clearText() {
    textInput.value = "";
    results.innerHTML = "";
}

checkBtn.addEventListener("click", checkPalindrome);
clearBtn.addEventListener("click", clearText);

</script>

</html>

Why doesn’t HTMX submit on enter with two inputs?

if you write something on the inputs, press enter, and inspect browser network, you’ll see that the “two inputs” don’t submit a request, but the “one input” does.
Why?

<script src="https://unpkg.com/[email protected]"></script>

<form hx-get=example.com>
  two inputs
  <input type=text name=a />
  <input type=text name=b />
</form>
<form hx-get=example.com>
one input
  <input type=text name=c />
</form>

CSS animation only works as intended when I re-save my style.css file?

I wrote a program that prompts the user to enter a temp and have that temp be reflected on a vertical bar that I have animated to change the height depending on the value given. The weird issue I’m running into is that it doesn’t work, but if I re-save my style.css file after entering a value it works as intended. From there, if I enter subsequent values it’ll jump to the expected heights while skipping the animation entirely.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
    <script src="script.js" defer></script>
</head>
<body>
    <div class="wrapper">
        <div class="temp-container">
            <div class="temp-indicator" id="indicator-1"></div>
        </div>
        <button onclick="changeTemp()">ENTER TEMP</button>
    </div>
</body>
</html>

:root {
    --temp-start: 0%;
    --temp-end: 0%;
}
.wrapper{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 50px;
}

.temp-container {
    width: 50px;
    height: 500px;
    margin: 50px 0px;
    background: black;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    border-radius: 25px;
  }
  
  .temp-indicator {
    width: 100%;
    mask:linear-gradient(#fff 0 0);
    border-radius: 25px;
  }

  .slide-to-temp {
    animation: slideToTemp 1s forwards;
  }

  @keyframes slideToTemp {
    from {height: var(--temp-start);}
    to {height: var(--temp-end);}
  }


  .temp-indicator::before {
    content:"";
    position: absolute;
    top:0;
    left:0;
    right:0;
    bottom:0;
    background-image: linear-gradient(red, lightblue 75%);
  }
  
  #indicator-1 {
    height: var(--temp-start);
  }


  button {
    padding: 20px;
    font-size: 20px;
    font-weight: 800;
    border: 5px solid black;
  }
let indicator = document.getElementById("indicator-1");
let root = document.documentElement;

function changeTemp() {
    let inputTemp = prompt("Enter a temp:");
    root.style.setProperty("--temp-end", `${inputTemp * 2}%`);

    indicator.classList.add("slide-to-temp");
}

The logic seems to check out, but clearly I’m missing something. Any help would be greatly appreciated.

react native: StyleSheet.compose(a, b) is deprecated; use array syntax, i.e., [a,b] error when using google signin

when integrating google sign-in in my react native app, i get the following error
error message

I was testing earlier and it was fine, but after adding some functionalities i got this error. Now, i tried to comment the new things i added, and even then, it’s not working, any idea on how to fix it ?

I am trying to integrate the google-signin api.

PS: i am not using the window.close nor the stylesheet.compose functions in my code.

How to increase and decrease the product’s quantity based on the “increment” value from the b2b catalog in Shopify Plus?

I am searching for a way to force the product’s quantity field to increase and decrease based on the minimum and increment for that product as set in its containing B2B catalog. For example, I have a product that is sold in increments of 6, and whose minimum is 6. When I click “plus” in the quantity box, I want it to increase to 12, 18, 24, etc. Likewise, when I click minus, it should then decrease from 24 to 18, 12, and back down to 6. It should also start at 6, not 1, since 6 is the minimum for that product. It should not be able to decrease to 0.

Some products may be 6, others may be 4, 12, etc. Therefore, I must use a dynamic field for the data.

This increment code works, but the decrement code decrements it all the way back down to the minimum value, instead of decreasing it by the increment value. If I can fix the decrement error, I think I will be good to go. Any ideas?

{% comment %}Increment code{% endcomment %}
    {% if customer.b2b? %}
      <script>
        document.addEventListener('DOMContentLoaded', function () {
          var quantityInput = document.querySelector('quantity-input input[name="quantity"]');
          
          {% assign minimumQuantity = product.variants.first.quantity_rule.min | default: 1 %}
          {% assign incrementQuantity = product.variants.first.quantity_rule.increment | default: 1 %}
          
          if (quantityInput) {
            // Ensure the initial value is set correctly
            quantityInput.value = "{{ minimumQuantity }}";
    
            // Update quantity on input change
            quantityInput.addEventListener('input', function () {
              var currentQuantity = parseInt(quantityInput.value);
              
              // Check if the entered quantity is less than the minimum
              if (currentQuantity < {{ minimumQuantity }}) {
                quantityInput.value = "{{ minimumQuantity }}";
              }
            });
    
            // Allow incrementing based on the product's "Increment" field
            var incrementButton = document.querySelector('quantity-input-plus');
            if (incrementButton) {
              incrementButton.addEventListener('click', function () {
                // Introduce a small delay to avoid the initial increment by 1
                setTimeout(function () {
                  var currentQuantity = parseInt(quantityInput.value);
    
                  // Skip the first increment by 1
                  if (currentQuantity !== parseInt("{{ minimumQuantity }}")) {
                    var remainder = currentQuantity % parseInt("{{ incrementQuantity }}");
                    var nextQuantity = remainder === 0 ? currentQuantity : currentQuantity - remainder + parseInt("{{ incrementQuantity }}");
    
                    quantityInput.value = nextQuantity;
                  }
                }, 10);
              });
            }
          }
        });
      </script>
    {% endif %}


{% comment %}Decrement code{% endcomment %}
    {% if customer.b2b? %}
      <script>
        document.addEventListener('DOMContentLoaded', function () {
          var quantityInput = document.querySelector('quantity-input input[name="quantity"]');
          var decrementButton = document.querySelector('quantity-input-minus');
    
          {% assign minimumQuantity = product.variants.first.quantity_rule.min | default: 1 %}
          {% assign incrementQuantity = product.variants.first.quantity_rule.increment | default: 1 %}
    
          if (quantityInput && decrementButton) {
            // Ensure the initial value is set correctly
            quantityInput.value = "{{ minimumQuantity }}";
    
            decrementButton.addEventListener('click', function () {
              var currentQuantity = parseInt(quantityInput.value);
              var decrementAmount = parseInt("{{ incrementQuantity }}");
              var nextQuantity = Math.max(currentQuantity - decrementAmount, {{ minimumQuantity }});
    
              quantityInput.value = nextQuantity;
            });
          }
        });
      </script>
    {% endif %}

ReactJS use a ready-made template (from template monster) [duplicate]

I’m learning to build a project in ReactJS with Typescript at the moment.

I have bought an HTML template from templatemonster. This is a very good template and has all the UI items I need to use for my project.

I have tried to import this to my ReactJS project.

I have successfully loaded all the css of the template and have made it look almost like it should for a start.

The issue is that the template from templatemonster is using two javascript scripts

core.min.js and script.js that need to be loaded as they control how some of the view items are working. Like how the accordions are opening/closing. Some of the animations, ui stuff in forms etc.

I load them using useEffect in my Header component:

Example:

    useEffect(() => {
        const script = document.createElement('script');

        script.src = "../js/core.min.js";
        script.async = true;

        document.body.appendChild(script);

        return () => {
            document.body.removeChild(script);
        }
    }, []);

I’m getting the following error for those scripts:

ReferenceError: $ is not defined

Is there any way to load a javascript file in react that won’t have an issue with $?

Access to the actual/visual DOM using custom elements and template

Say I have this thing called a “panel”. It contains a hidden section and a button to show it. Easy enough.

However I got a little fancy and decided to use a custom element <custom-panel> to markup the boundaries for each panel, a <template> for the contents and <slots> for the configuration (title, details, etc).

Now I am a little confused as to how to hook up the buttons. The template has CSS that will show/hide the details of the panel if the correct class is set. But how to I set it? I have only figured out how to get to the contents of the template (without the resolved slots) or the custom-panel’s contents (with no template information).

Complete Example:

customElements.define(
  'custom-panel',
  class extends HTMLElement {
    constructor() {
      super();

      const template = document.getElementById('custom-panel-template');
      const templateContent = template.content;

      this.attachShadow({
        mode: 'open'
      }).appendChild(
        templateContent.cloneNode(true)
      );
    }
  }
);
<!DOCTYPE html>
<html lang="en">

<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Custom Panels</title>
</head>

<body>

  <custom-panel>
    <span slot="openButtonText">Open Panel 1</span>
    <span slot="closeButtonText">Close Panel 1</span>
    <span slot="panelName">Panel 1</span>
    <div slot="">Panel 1 Details</div>
  </custom-panel>
  <custom-panel>
    <span slot="openButtonText">Open Panel 2</span>
    <span slot="closeButtonText">Close Panel 2</span>
    <span slot="panelName">Panel 2</span>
    <div slot="panelContent">Panel 2 Details</div>
  </custom-panel>

  <template id="custom-panel-template">
        <style type="text/css">
            #panel {
                display: none;
            }
            
            #panel.open {
                display: revert;
            }
        </style>
        
        <!-- how do these get hooked in? -->
        <button type="button"><slot name="openButtonText">Default Open Button Text</slot></button>
        <button type="button"><slot name="closeButtonText">Default Close Button Text</slot></button>
        
        <fieldset id="panel">
            <legend><slot name="panelName">Default Panel Name</slot></legend>
            <slot name="panelContent">Default Panel Content</slot>
        </fieldset>
    </template>

</body>

</html>

Error deploy on vercel in my webproject nextJS

I have a new project in next.JS in which I display a teiled map with phaserJS.

But when I deploy my project I get this error on vercel (on my localhost I have no problem)

here is my code on Home.js :

const Home = () => {
    const gameContainer = useRef(null);
    const gameInstance = useRef(null);
    const loadingMessage = useRef(null);
    const notify = (text) => toast(text);

    useEffect(() => {
        import('phaser').then(Phaser => {
            const SceneMain = require('../scenes/SceneMain').default;
            const config = {
                type: Phaser.AUTO, parent: gameContainer.current, width: "75%",
                height: "84%",
                scene: [SceneMain],
                physics: {
                    default: 'arcade', arcade: {}
                }
            };

            gameInstance.current = new Phaser.Game(config);
            gameContainer.current.style.borderRadius = '15px';
            gameContainer.current.style.overflow = 'hidden';
            gameContainer.current.addEventListener('click', () => {
                gameInstance.current.input.keyboard.enabled = true;
            });
            gameInstance.current.scene.scenes.forEach(scene => {
                scene.events.on('create', () => {
                    const mapWidth = 2208;
                    const mapHeight = 1408;

                    scene.cameras.main.setBounds(0, 0, mapWidth, mapHeight, true);
                    scene.cameras.main.setZoom(Math.min(gameInstance.current.scale.width / mapWidth, gameInstance.current.scale.height / mapHeight));
                    scene.cameras.main.centerOn(mapWidth / 2, mapHeight / 2);

                    loadingMessage.current.style.display = 'none';
                });
            });

            return () => {
                gameInstance.current.destroy(true);
            };
        });
    }, []);

and here is code in my sceneMain.js :

export class SceneMain extends Phaser.Scene {
    constructor() {
        super("SceneMain");
    }

    preload() {
        this.load.image("tiles", "/assets/tileset.png");
        this.load.tilemapTiledJSON('map', "/assets/othman_map.json");
        this.load.spritesheet('character', '/assets/perso.png', { frameWidth: 32, frameHeight: 32 });
    }
    
    create() {
        const map = this.make.tilemap({key: "map", tileWidth: 16, tileHeight: 16});
        const tileset = map.addTilesetImage("tiles1", "tiles");
        const layer = map.createLayer("Calque de Tuiles 1", tileset, 0, 0);
        const colision = map.createLayer("Collision", tileset, 0, 0)
        this.player = this.physics.add.sprite(785,655,"character").setFrame(5);
    ...
    }
    
    update() {
    ...
    }
}
export default SceneMain;

when i deploy on vercel i have this erreur :
ReferenceError: HTMLVideoElement is not defined

01:11:39.365 | at Object.<anonymous> (/vercel/path0/node_modules/phaser/src/polyfills/requestVideoFrame.js:3:1)
01:11:39.366 | at Module._compile (node:internal/modules/cjs/loader:1256:14)
01:11:39.366 | at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
01:11:39.366 | at Module.load (node:internal/modules/cjs/loader:1119:32)
01:11:39.367 | at Module._load (node:internal/modules/cjs/loader:960:12)
01:11:39.367 | at Module.require (node:internal/modules/cjs/loader:1143:19)
01:11:39.367 | at mod.require (/vercel/path0/node_modules/next/dist/server/require-hook.js:65:28)
01:11:39.367 | at require (node:internal/modules/cjs/helpers:119:18)
01:11:39.367 | at Object.<anonymous> (/vercel/path0/node_modules/phaser/src/phaser.js:7:1)
01:11:39.368 | at Module._compile (node:internal/modules/cjs/loader:1256:14)
01:11:39.368 |  
01:11:39.368 | > Build error occurred
01:11:39.368 | Error: Failed to collect page data for /scenes/SceneMain
01:11:39.368 | at /vercel/path0/node_modules/next/dist/build/utils.js:1258:15
01:11:39.368 | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
01:11:39.369 | type: ‘Error’
01:11:39.369 | }
01:11:39.393 | Error: Command “npm run build” exited with 1

if you have any idea how to solve this error, I’d love to hear from you.

Thanks soo much in advance for your help!

i have trie to add this code in home.js but it’s the same :

if (typeof HTMLVideoElement !== ‘undefined’) {