How to use custom endpoint as singleType collections attribute?

I set up a strapi custom endpoint that returns a number timestamp. But I already have a config content-type with following schema.json

{
  "kind": "singleType",
  "collectionName": "default_conversion_currencies",
  "info": {
    "singularName": "default-conversion-currency",
    "pluralName": "default-conversion-currencies",
    "displayName": "default-conversion-currency"
  },
  "options": {
    "draftAndPublish": false,
    "comment": ""
  },
  "attributes": {
    "code": {
      "type": "string",
      "default": "USDT",
      "required": true
    }
  }
}

and i want those two attributes to be received within one request. Is there any way of addding custom api/service/controller as attribute of another content-type ?

stop opening the default browser menu on long press in mobile using angular js

There is anchor tag in the mobile. when long press the anchor tag i need to show a tooltip. but suddenly browser’s menu is opening. How to stop opening the browser menu, when long press the anchor tab in angular js.

import { Directive, ElementRef, EventEmitter, HostListener, Output } from '@angular/core';

@Directive({
    selector: '[appLongPress]'
})

export class LongPressDirective {
    @Output() longPress = new EventEmitter<void>();
    private timeoutId: any;

    constructor(private elementRef: ElementRef) {}

    @HostListener('touchstart', ['$event'])
    onTouchStart(event: TouchEvent) {
        this.timeoutId = setTimeout(() => {
            this.longPress.emit();
            event.preventDefault(); // Prevent default action
            event.stopPropagation();
        }, 500); // Adjust the duration as needed
    }

    @HostListener('touchend')
    onTouchEnd() {
        clearTimeout(this.timeoutId);
    }
}

How to avoid JavaScript function printed as is instead of being executed in a PHP file when called with AJAX?

Structure of the code

I have three files, CorePHP.php, verifyEmail.php and Registration.php.
I am making a sign up system for my website with these files. Registration.php holds the UI and JS code for the sign up page while verifyEmail.php holds the php code necessary to send the email for verification to the user. CorePHP.php holds the necessary JS functions for verifyEmail.php, namely createCookie() and SendEmail() functions. The verifyEmail.php file is called by AJAX in Registration.php and the data echoed in the verifyEmail.php file is recieved in the variable data in Registration.php. I include the php file of CorePHP.php in the verifyEmail.php file to get the reference of the functions necessary and call those functions using this code below –

verifyEmail.php

$subject = "Do not reply. Udyam BMS email verification.";
$body = "Hello Future User! <br> This email is sent to verify the email ID with which you are trying to sign in to Udyam BMS. Enter this code- $code in the registration page to verify your email ID. <p style='color: red'>Do not share the code with anyone else</p>";
$to = $email;
echo "<script>
        var message = SendEmail(`$subject`, `$body`, `$to`);
        createCookie('emailVStatus', message, 1);
        </script>";

I create the cookie emailVStatus so that I can access it in PHP and get to know the status of the SendEmail() function (The function returns 1 or 0 based on the success of sending the email).

Also, the CorePHP.php file looks like –

CorePHP.php

<?php
   //some irrelevant php code
?>



<html>

<body>
    <script>
  //The functions required are defined here
        function SendEmail(subject, body, to, cc, bcc) {
            var dataJson = JSON.stringify({
                "to": to,
                "cc": cc,
                "bcc": bcc,
                "subject": subject,
                "emailbody": body
            });

            var urlStr = "https://prod-12.centralindia.logic.azure.com:443/workflows/918a1e4a479e460b82d5073e973fc46d/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=C7KmI5P5x0vLOYqYgzuA5P-zjUEDDRutLPuPec8nXLc";

            var ajax = new XMLHttpRequest();
            ajax.open("POST", urlStr, true);
            ajax.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
            ajax.onreadystatechange = function() {
                if (this.readyState == 4 && this.status == 200) {
                    var emailmessage = 0;
                    return emailmessage;
                }
                if (this.status >= 400) {
                    var emailmessage = 1;
                    return emailmessage;
                }
            };

            ajax.send(dataJson);
        }

        function createCookie(name, value, days) {
            var expires;
            if (days) {
                var date = new Date();
                date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
                expires = "; expires=" + date.toGMTString();
            } else {
                expires = "";
            }
            document.cookie = escape(name) + "=" + escape(value) + expires + "; path=/";
        }
    </script>
</body>

</html>

Expected Output

In Registration.php file, I expected the data returned in data variable should only contain an array of the structure [*the message returned by the file to be displayed*, *a status code (1 or 0)*]. A record is also inserted into a MySQL table and an email is sent for verification by the verifyEmail.php file.

Problem

The problem with this code is, instead of the expected result in data variable, the data variable, it seems, contains the whole HTML part of CorePHP.php and the echoed <script></script> in verifyEmail.php. It did not even execute those functions in JS and instead passed it as returned data to the AJAX call in Registration.php. It performed the MySQL query for inserting an record fine but did not call these JS functions.

Things I have tried to solve this

I tried to remove the JS functions from the verifyEmail.php file but it cannot be done because the SendEmail() function works with an API and therefore uses an AJAX call and I do not think that it would be able to run in PHP (or would it? I am new to this stuff and don’t know much about this). So, I tried to instead call these JS functions after the AJAX call is made and the record has been inserted in Registration.php but the purpose of sending the email is that a randomly generated code is sent in it and the user has to input it in Registration.php to verify their email ID and if I send the email from the same file, the user would be able to know the randomly generated code if he/she knows how to use inspect tools in the browser which will be a security concern.

I can’t possibly think of any other solution for this problem and therefore have turned to this site for answering my question.

CSS transition not working properly after the cursor hover effect

I have made a header where there are some links and a company logo which is in “flex, align-item:center and justify-content:space-between”. I have made CSS transition in links. Transition which is not working is something like that whenever user hover the link all four side corners of border will be visible and when the user leave the hover it will be invisible is not working because when we leave the cursor from the link the border starts appearing and I am not able to solve it.

NOTE:- Second transition which is flip the text is working fine.

const menuItems = [...document.querySelectorAll('.menu-item')];

    menuItems.forEach(item => {
        let word = item.children[0].children[0].innerText.split('');
        item.children[0].innerHTML = '';
        word.forEach((letter, idx) => {
            item.children[0].innerHTML += `<span style="--index: ${idx};">${letter}</span>`;
        })
        let cloneDiv = item.children[0].cloneNode(true);
        cloneDiv.style.position = 'absolute';
        cloneDiv.style.left = '0';
        cloneDiv.style.top = '0';
        cloneDiv.style.padding = '10px';
        item.appendChild(cloneDiv)
    });
* {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    body {
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(8px);
        background: #000;
    }

    .menu a {
        padding: 10px;
        color: #fff;
        border: 2px solid #000;
        opacity: 1;
        transition: 3s;
    }

    .menu a:hover {
        border: 2px solid #fff;
        transition: 3s;
    }

    .menu a:hover:before {
        content: '';
        position: absolute;
        top: 6px;
        left: -2px;
        width: calc(100% + 4px);
        height: calc(100% - 12px);
        background: #000;
        transform: scaleY(1);
        opacity: 1;
        transition: 3s;
    }

    .menu a:hover:after {
        content: '';
        position: absolute;
        left: 6px;
        top: -2px;
        height: calc(100% + 4px);
        width: calc(100% - 12px);
        background: #000;
        transform: scaleX(1);
        opacity: 1;
        transition: 3s;
    }

    .menu a div:nth-child(1) {
        z-index: 1;
        position: relative;
    }

    .menu a div:nth-child(2) {
        z-index: 1;
    }

    .header-container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px 5%;
    }

    .header-container .logo {
        width: 50px;
        height: 50px;
    }

    .header-container .logo a {
        width: 100%;
        height: 100%;
        display: block;
    }

    .header-container .logo img {
        width: 100%;
        height: 100%;
    }

    .menu {
        position: relative;
        top: 0;
        left: 0;
        width: auto;
        display: flex;
        align-items: center;
    }

    .menu .menu-item:not(:last-child) {
        margin-right: 20px
    }

    .menu-item {
        position: relative;
        text-transform: uppercase;
        color: #fff;
        cursor: pointer;
    }

    .menu-item-text {
        position: relative;
        pointer-events: none;
        display: block;
        line-height: 1;
        font-size: 2rem
    }

    .menu-item>div:nth-child(1) span {
        will-change: transform;
        transform-style: preserve-3d;
        transition: 0.5s;
        transition-delay: calc(0.05s * var(--index));
        transform-origin: bottom;
        display: inline-block;
    }

    .menu-item>div:nth-child(2) span {
        will-change: transform;
        transform-style: preserve-3d;
        transition: 0.5s;
        transition-delay: calc(0.05s * var(--index));
        transform-origin: top;
        display: inline-block;
        transform: translate3d(0, 100%, 0) rotateX(-90deg);
    }

    .menu-item:hover>div:nth-child(1) span {
        transform: translate3d(0, -100%, 0) rotateX(-90deg);
    }

    .menu-item:hover>div:nth-child(2) span {
        transform: translate3d(0, 0%, 0) rotateX(0deg);
    }

    span {
        font-size: 1vw;
    }
<div class="header-container">
        <div class="logo">
            <a href="#">
                <img src="../img/logo.png" alt="Company Logo">
            </a>
        </div>
        <nav class="menu">
            <a href="home.php" class="menu-item">
                <div>
                    <span class="menu-item-text">Home</span>
                </div>
            </a>
            <a href="#" class="menu-item">
                <div>
                    <span class="menu-item-text">Services</span>
                </div>
            </a>
            <a href="#" class="menu-item">
                <div>
                    <span class="menu-item-text">Start&nbsp; a &nbsp; Project</span>
                </div>
            </a>
            <a href="#" class="menu-item">
                <div>
                    <span class="menu-item-text">Projects</span>
                </div>
            </a>
            <a href="#" class="menu-item">
                <div>
                    <span class="menu-item-text">About Us</span>
                </div>
            </a>
        </nav>
    </div>

Creating a transport using Nodemailer with TypeScript

I am creating a transport(createTransport) using nodemailer

import { createTransport } from "nodemailer";
import type { Transporter } from "nodemailer";
import type SMTPTransport from "nodemailer/lib/smtp-transport";

interface EmailServerConfig {
  host: string;
  port: number;
  auth: {
    user: string;
    pass: string;
  };
  secure: boolean;
}

const transporterConfig: EmailServerConfig = {
  host: env.EMAIL_SERVER_HOST,
  port: 465,
  auth: {
    user: env.EMAIL_SERVER_USER,
    pass: env.EMAIL_SERVER_PASSWORD,
  },
  secure: true,
};

// Create a nodemailer transporte
const transporter: Transporter<SMTPTransport.SentMessageInfo> = createTransport(transporterConfig);

and I am getting the following error

Unsafe assignment of an any
value.eslint@typescript-eslint/no-unsafe-assignment Unsafe call of an
any typed value.eslint@typescript-eslint/no-unsafe-call (alias)
createTransport(transport?: string | SMTPTransport |
SMTPTransport.Options | undefined, defaults?: SMTPTransport.Options |
undefined): Transporter<…> (+6 overloads) import createTransport

not sure what i am doing wrong. let me know if I can fix it.

How to get duplicate values with different keys in One Object Javascripts?

I need some help to get Object keys that have duplicate values.
What i have is about 10000 keys in Object name numn (This is example)

numn={
    "28": "The invincible special forces who returned to the Three Kingdoms(回到三国的无敌特种兵)",
    "46": "Three Kingdoms: The opening incorporates Li Cunxiao(三国:开局融合了李存孝)",
    "62": "Douluo: Super Beast Armed Guard Zhu Zhuqing(斗罗:超兽武装守护朱竹清)",
    "76": "The Oriental Cavalry that swept across the Three Kingdoms(横扫三国的东方铁骑)",
    "1514": "The Rise of an Empire(帝国崛起)",
    "3140": "A leisurely life in another world(异界的悠闲生活)",
    "5117": "The rise of an empire(帝国崛起)",
    "5127": "After eavesdropping on my voice, the whole family went crazy(偷听我心声后,全家都杀疯了)",
    "5148": "The Rise of an Empire(帝国崛起)",
    "8440": "A ghost calls at the door in the middle of the night(夜半鬼叫门)",
    "13140": "A leisurely life in another world(异界的悠闲生活)",
    "13154": "The time travel story of Iron Ambition Man(钢铁雄心之舰男穿越记)",
}

What i want is to get all duplicate values with its keys like this

numn={
    "1514": "The Rise of an Empire(帝国崛起)",
    "5117": "The rise of an empire(帝国崛起)",
    "5148": "The Rise of an Empire(帝国崛起)",
    "3140": "A leisurely life in another world(异界的悠闲生活)",
    "13140": "A leisurely life in another world(异界的悠闲生活)",
}

I tried this

let findDuplicates = arr => arr.filter((item, index) => arr.indexOf(item) !== index)
Duplicates=findDuplicates(Object.values(numn))

but it only get duplicate values without it keys

Duplicates=[
'The Rise of an Empire(帝国崛起)',
'A leisurely life in another world(异界的悠闲生活)'
]

Please help me and
Sorry for my bad writing in English

html2canvas: Unable to Capture Screenshots with Other-Origin Images

I’m encountering issues capturing a screenshot of a current webpage using html2canvas when the page includes images from other origins. Despite enabling CORS headers on my server with Access-Control-Allow-Origin: *, I’m still receiving the error message “Failed to execute ‘toDataURL’ on ‘HTMLCanvasElement’: Tainted canvases may not be exported.

Here’s the code I’m using:

html2canvas(document.body, {
    allowTaint: true,
    useCORS: true,
    type: 'view'
}).then(function (canvas) {
     var dataURL = canvas.toDataURL("image/png");
});

What could be causing this error, and how can I resolve it to successfully capture screenshots including images from other origins?

On Storing Large Base64 Image Data In Local Storage Gives Quota Exceeded Error In JS

I m using javascript and getting image url in base64 format want to store it temporarily wth localstorage of js but it sometimes give me quota exceeded error in browser console of chrome browser so how can i do that?

I got image path in base64 and shown in console issue i face not able to store it in localstorage func of js if base64 data is too large so i want to solve it for base64 without size limit or quota exceeded error

TypeError: n.indexOf is not a function (Firebase Cloud Firestore

i’m trying to use the update feature from the cloud firestore to subtract from the original field with a inputed values but my function isn’t working well . Here’s the code .

const postID = document.getElementsByClassName("newID")
document.addEventListener("DOMContentLoaded", function () {

  buttonpay.addEventListener("click", handleUpdate);

  async function handleUpdate(e) {
    e.preventDefault();

    // Get form input values
    const description = document.getElementsByClassName("description").parseInt - document.getElementsByClassName("quantity-input").parseInt
    try {
      const docRef = doc(db, "posts", postID);
      await updateDoc(docRef, {
        description,
      });
    } catch (error) {
      console.log(error);
    }
  }
});

i’ve tried searching for the solution but none worked . can someone fixed it ?

How to solve Map.data is not a function error?

Error: data?.map is not a function?
Im making a blog site,
and After adding database and route file I’m getting this error.
You can look at this repo: https://github.comenter image description here/safak/next-blog

I did try modifying the code and/or eliminating it but still it won’t work,
I also check on route.js file, but it returns “empty prisma client”.

Can someone suggest how to fix it?

React: UI Flickers When Updating State for Cart Item Quantity

I’m developing a shopping cart feature in a Next.js application using React hooks, where I face an issue with UI flickering. Specifically, the problem arises when updating the quantity of cart items. For each quantity change, I perform an asynchronous check to verify item availability, which seems to be causing the UI to flicker between the old and new values.

When I adjust the quantity of a cart item through an input field, I’m making an asynchronous call (fetchItemAvailability) to check the availability of the item. This async call is causing the UI to flicker: the input field value rapidly alternates between the old and new quantity values. I want the UI to update smoothly to show the new value once the availability check is completed.

This is the Function to fetch item availability

export async function fetchItemAvailability(itemId: string) {
 try {
  const response = await fetch(`http://localhost:3000/api/items/${itemId}`);
  if (!response.ok) throw new Error('Network response was not ok.');
  const item = await response.json();
  return item.availableSupply; 
}catch (error) {
  console.error('Error fetching item availability:', error);
  return 0; 
 }
}

This is the cart page. It is responsible for displaying the items in the cart, and allowing the
user to checkout and purchase the items in the cart.

export default function Cart() {
  const [user, setUser] = useState<User | null>(null); // The current user
  const [cartItems, setCartItems] = useState<CartItem[]>([]); // The items in the card
  const [cartCheckoutLoading, setCartCheckoutLoading] =
    useState<boolean>(false); // Whether the cart is currently checking out
  const { toast } = useToast(); // The toast hook
  
  /*
    On page load, get the cart items from local storage.
  */
  useEffect(() => {
    /*
       Get the cart items from local storage
       Parse the cart items as a CartItem array and update the cart items state
    */
    // This effect gets the cart items from local storage.
      const loadCartItems = async () => {
        const session = await getSession(); // Asynchronously get the session data
        if (session?.user?.name) {
          const storedCarts = localStorage.getItem('carts'); // Get 'carts' from local storage
          if (storedCarts) {
            const carts = JSON.parse(storedCarts); // Parse the stored cart JSON
            // Check if the user's cart exists in the stored carts and set it, or initialize as empty
            setCartItems(carts[session.user.name] || []);
          } else {
            // If no carts are stored at all, initialize local storage with an empty object
            localStorage.setItem('carts', JSON.stringify({}));
            setCartItems([]); // Initialize cartItems as an empty array if nothing in local storage
          }
        }
      };
    
      loadCartItems(); // Call the function to load cart items
    }, []); // The dependency array is empty, so this effect runs once on component mount

  /*
    On page load, get the current user.
  */
  useEffect(() => {
    /*
       Get the current user from the session and update the user state
    */
    // This effect gets the current user from the session.
    const fetchUserDetails = async () => {
      const session = await getSession();
      if (session?.user?.name) {
        const userDetails = await getUser(session.user.name);
        setUser(userDetails);
      }
    };
    fetchUserDetails();
    }, []);


  /*
    Dispatches an event to the window whenever the cart items change.
  */
  useEffect(() => {
    /* 
       Dispatch an event to the window whenever the cart items change. 
      HINT: Dispatch an event with the name "cartUpdated"
    */
      window.dispatchEvent(new Event('cartUpdated'));
    }, [cartItems]);
  
  async function updateCartItemsAvailability() {
      const updatedCartItems = await Promise.all(cartItems.map(async (item) => {
        const availability = await fetchItemAvailability(item.id);
        return { ...item, available: availability };
      }));
      setCartItems(updatedCartItems);
  }
    
  useEffect(() => {
    updateCartItemsAvailability();
  }, [cartItems]); // Re-run when cartItems changes
    

  /*
    This is the cart card component. It is responsible for displaying a single item in the cart.
  */
  const CartCard =  React.memo(({ title, quantity, price, image, id }: CartItem) => {
  const validImageSrc = image || '/noimage.png';

    return (
      <div className="bg-white p-6 flex flex-row gap-6">
        <Image
          src={validImageSrc}
          alt="Background Image"
          className="shrink-0"
          width={160}
          height={160}
          onError = {(e) =>{ e.currentTarget.onerror = null;
          e.currentTarget.src = '/noimage.png';  }}
        />
        <div className="flex flex-col gap-3">
          <p className="text-xl font-medium">{title}</p>
          <div className="flex flex-row gap-6 items-center">
            <div className="flex">
              <div className="flex flex-row items-center border border-black/25 rounded py-2 px-3 space-x-2">
                <p className="">Qty:</p>
                <Input
                  className="w-20 h-8 bg-white border-0"
                  type="number"
                  value={quantity}
                  onChange={async(e) => {
                    
                    // Early exit if user is null
                    if (!user) {
                      console.error("User is not defined");
                      return;
                    }
                  
                    const newQuantity = Number(e.target.value);
                    console.log('new quantity = '+ newQuantity);
                  
                    // Check for invalid input
                    if (Number.isNaN(newQuantity) || newQuantity < 1) {
                      return;
                    }

                    const available = await fetchItemAvailability(id);

                  
                    // Check if the new quantity exceeds the available quantity
                    if (newQuantity > available) {
                      toast({
                        title: 'Stock Limit Alert',
                        description: `This quantity exceeds our current stock. Available: ${available}. Please adjust.`,
                      });
                      return;
                    }

                    console.log('available = '+ available);

                  
                    const storedCarts = JSON.parse(localStorage.getItem('carts') || '{}');
                    const userCart = storedCarts[user.username] || [];
                  
                    const index = userCart.findIndex((item: CartItem) => item.id === id);
                  
                    const updatedCartItems = userCart.map((cartItem: CartItem, cartIndex: number) => 
                      cartIndex === index ? { ...cartItem, quantity: newQuantity } : cartItem
                    );
                  
                    // Update the cart for the current user in the `carts` object
                    storedCarts[user.username] = updatedCartItems;
                  
                    // Update local storage with the new `carts` object
                    localStorage.setItem('carts', JSON.stringify(storedCarts));
                  
                    // Update the state to reflect the changes
                    setCartItems(updatedCartItems);

                  }}
                />

              </div>
            </div>
          </div>
        </div>
      </div>
    );
  });

  1. I’ve used useState to manage the cart items and the quantity state of each item.
  2. I’ve implemented React.memo for the CartCard component to prevent unnecessary re-renders.
  3. The onChange handler in the CartCard component makes an async call to check item availability every time the quantity is changed.
  4. I’ve attempted to use a debounce technique to limit the frequency of availability checks during rapid input changes. Despite this, the UI still exhibits flickering behavior, which suggests that the debounce implementation might not be effectively managing the async state updates or there’s an underlying issue I’ve overlooked.

How can I prevent the UI from flickering in response to these asynchronous updates? Is there a recommended approach in React for managing state updates in a list of dynamically rendered components (like a shopping cart) when dealing with async operations, such as checking item availability?

I would greatly appreciate any advice, best practices, or code examples that could help resolve this flickering issue.

ERROR #98123 WEBPACK.BUILD-JAVASCRIPT Generating JavaScript bundles failed while building gatsby site

I’ve been trying to build my gatsby site but the build is failing with an error as

failed Building production JavaScript and CSS bundles - 7.408s

 ERROR #98123  WEBPACK.BUILD-JAVASCRIPT

Generating JavaScript bundles failed

styles.41cdc950875b04ce14b3.css from Css Minimizer
/Users/rit/proj1/styles.41cdc950875b04ce14b3.css:1175:18: Unknown word [styles.41cdc950875b04ce14b3.css:1175,18]
    at Input.error (/Users/rit/proj1/node_modules/postcss/lib/input.js:106:16)
    at Parser.unknownWord (/Users/rit/proj1/node_modules/postcss/lib/parser.js:593:22)
    at Parser.other (/Users/rit/proj1/node_modules/postcss/lib/parser.js:435:12)
    at Parser.parse (/Users/rit/proj1/node_modules/postcss/lib/parser.js:470:16)
    at parse (/Users/rit/proj1/node_modules/postcss/lib/parse.js:11:12)
    at new LazyResult (/Users/rit/proj1/node_modules/postcss/lib/lazy-result.js:133:16)
    at Processor.process (/Users/rit/proj1/node_modules/postcss/lib/processor.js:53:14)
    at cssnanoMinify (eval at transform (/Users/rit/proj1/node_modules/gatsby/node_modules/css-minimizer-webpack-plugin/dist/minify.js:34:28), <anonymous>:51:61)
    at minify (/Users/rit/proj1/node_modules/gatsby/node_modules/css-minimizer-webpack-plugin/dist/minify.js:15:32)
    at Object.transform (/Users/rit/proj1/node_modules/gatsby/node_modules/css-minimizer-webpack-plugin/dist/minify.js:35:24)

File: styles.41cdc950875b04ce14b3.css


 ERROR #98123  WEBPACK.BUILD-JAVASCRIPT

Generating JavaScript bundles failed

styles.d9f8181dfdee20ae152d.css from Css Minimizer
/Users/rit/proj1/styles.d9f8181dfdee20ae152d.css:1175:18: Unknown word [styles.d9f8181dfdee20ae152d.css:1175,18]
    at Input.error (/Users/rit/proj1/node_modules/postcss/lib/input.js:106:16)
    at Parser.unknownWord (/Users/rit/proj1/node_modules/postcss/lib/parser.js:593:22)
    at Parser.other (/Users/rit/proj1/node_modules/postcss/lib/parser.js:435:12)
    at Parser.parse (/Users/rit/proj1/node_modules/postcss/lib/parser.js:470:16)
    at parse (/Users/rit/proj1/node_modules/postcss/lib/parse.js:11:12)
    at new LazyResult (/Users/rit/proj1/node_modules/postcss/lib/lazy-result.js:133:16)
    at Processor.process (/Users/rit/proj1/node_modules/postcss/lib/processor.js:53:14)
    at cssnanoMinify (eval at transform (/Users/rit/proj1/node_modules/gatsby/node_modules/css-minimizer-webpack-plugin/dist/minify.js:34:28), <anonymous>:51:61)
    at minify (/Users/rit/proj1/node_modules/gatsby/node_modules/css-minimizer-webpack-plugin/dist/minify.js:15:32)
    at Object.transform (/Users/rit/proj1/node_modules/gatsby/node_modules/css-minimizer-webpack-plugin/dist/minify.js:35:24)

File: styles.d9f8181dfdee20ae152d.css

not finished Running gatsby-plugin-sharp.IMAGE_PROCESSING jobs - 7.927s

Some context

To install the packages I use – npm i -f ( as there are some dependency issues ). It installs successfully.

The develop works fine – npm run dev

However, when I try to run npm run build it fails with the error above. I am not sure how to even debug this, as I can’t find those files in here on my system.

Unknown word [styles.d9f8181dfdee20ae152d.css:1175,18]

Update 1

I realised that removing all the css from global.css file allows for getting the build working. Though even before there was this file with css in it and the build used to pass that time.

How to show X-axis label for the only points where data is available?

I am plotting a time graph with echarts. I have only two data points I want to show in the graph. The graph shows those two points correctly, but it shows more than 2 labels on x axis (time axis), which is obviously the uniform time difference between those 2 data points. What I want is to see the time labels only for the data points I have. How can I do that?

I tried passing the time values in xAxis.data also, but it is not working.

I have created a demo graph for reference here.

Current Result:
Current Result Chart

Expected Result: Time label should be displayed under the bars only.

Should I commit my dist folder that is a mirror structure of my src folder to git?

It’s my first time building a server with typescript (using node/expres). My question is. after compiling the typescript, it spits out a mirror structure of my typescript files, which should i commit to git repository. The confusion is:

  1. when i deploy to vercel from github, which one is vercel going to run ?
  2. if i exclude the src folder, then how can my team get the source code of the typescript files when i make changes. ?

This is my git ignore, i added the dist folder, but i think it’s wrong, please correct me.


#
dist/

# dependencies
node_modules/

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
*.pem

# local env files
.env*.local

# typescript
*.tsbuildinfo