why process.env.NODE_ENV becomes 'production' after bundling inside React component when running on development server

Viewed 15

I'm writing a React lib for Resizable element.

console.log(process.env.NODE_ENV); inside Resizable.tsx(the source file) would result in development, but
console.log(process.env.NODE_ENV); results in production on resizable.es.js(the production build).

for this test app which runs on development environment

const App = () => {
  return (
    <>
      <Resizable>
        <div>123</div>
      </Resizable>
      <ResizableDev>
        <div>123</div>
      </ResizableDev>
    </>
  );
};

we would see these results:

enter image description here

super strange! process.env.NODE_ENV is supposed to be the environment of the current server and not the current build type of a component, or maybe I'm missing something ? help would be appreciated!

0 Answers
Related