DEV

DEV

1
const DEV: object | undefined;

On the client, Solid provides (via conditional exports) different builds depending on whether the development condition is set. Development mode provides some additional checking — e.g. detecting accidental use of multiple instances of Solid — which are removed in production builds.

If you want code to run only in development mode (most useful in libraries), you can check whether the DEV export is defined. Note that it is always defined on the server, so you may want to combine with isServer:

1
2
3
4
5
6
import { DEV } from "solid-js";
import { isServer } from "solid-js/web";

if (DEV && !isServer) {
  console.log(...);
}

Комментарии