reactjsvitecomments

Would comments in ReactJS show in client browsers with Vite?


Currently, I am using Vite with ReactJS and have the following two types of comments inside my codes, for example:

export const Main = () => {

  useEffect(() => {
    // console.log("first type of comment.");
  }, [])
  
  return (
    <>
      {/* <div>Second type of comment.</div> */}
    </>
  );
}

Will these two types of comments be visible in client browsers, if I use vite and vite build, respectively?

For similar issues, How comment a JSP expression? talks about whether the comments will be visible in client browsers, but it is for JSP type of comments.


Solution

  • It depends on build process. When you run a prod build - vite build, it initiates a minification process and strips of both style of comments