{ "id": "6eeb1052e1f1895621cfc7f4", "source": "solid:signals", "type": "github-document", "title": "is-server", "content": "---\ntitle: isServer\nuse_cases: \u003e-\n conditional rendering, ssr vs client code, bundle optimization,\n environment-specific logic, code splitting\ntags:\n - ssr\n - environment\n - bundling\n - optimization\n - conditional\nversion: '1.0'\ndescription: \u003e-\n Detect server or browser environment with isServer. Optimize bundle sizes by\n conditionally including code for specific runtime environments.\n---\n\n```ts\nimport { isServer } from \"solid-js/web\"\n\nconst isServer: boolean\n\n```\n\nThis indicates that the code is being run as the server or browser bundle.\nAs the underlying runtimes export this as a constant boolean it allows bundlers to eliminate the code and their used imports from the respective bundles.\n\n```ts\nimport { isServer } from \"solid-js/web\";\n\nif (isServer) {\n\t// I will never make it to the browser bundle\n} else {\n\t// won't be run on the server;\n}\n```", "url": "https://github.com/solidjs/solid-docs/blob/HEAD/src/routes/reference/rendering/is-server.mdx", "metadata": { "path": "src/routes/reference/rendering/is-server.mdx", "repo": "solidjs/solid-docs", "repo_url": "https://github.com/solidjs/solid-docs.git", "size": 868, "source_type": "github" }, "hash": "9ad0b64f451ebd7ceaa5dfe73b42436285ddbac7fd2ff50720ca3c5913a89fac", "timestamp": "2026-02-23T11:43:00.190361623+01:00" }