{"record":{"id":"62b7eb85bff8c0f0","repo":"sveltejs/kit","slug":"cannot-import-normalized-into-code-that-runs-in","errorCode":null,"errorMessage":"Cannot import ${normalized} into code that runs in the browser, as this could leak sensitive information.\\n\\n${pyramid}\\n\\nIf you're only using the import as a type, change it to `import type`.","messagePattern":"Cannot import (.+?) into code that runs in the browser, as this could leak sensitive information\\.\\\\n\\\\n(.+?)\\\\n\\\\nIf you're only using the import as a type, change it to `import type`\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/kit/src/exports/vite/plugins/guard.js","lineNumber":204,"sourceCode":"\t\t\t\tconst chain = find_chain(normalized, [normalized]);\n\n\t\t\t\tif (chain) {\n\t\t\t\t\tif (chain.some((id) => remote_module_pattern.test(id))) {\n\t\t\t\t\t\terror_for_missing_config('remote functions', 'experimental.remoteFunctions', 'true');\n\t\t\t\t\t}\n\n\t\t\t\t\tconst pyramid = chain\n\t\t\t\t\t\t.reverse()\n\t\t\t\t\t\t.map((id, i) => {\n\t\t\t\t\t\t\treturn `${' '.repeat(i + 1)}${id}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(' imports\\n');\n\n\t\t\t\t\tlet message = `Cannot import ${normalized} into code that runs in the browser, as this could leak sensitive information.`;\n\t\t\t\t\tmessage += `\\n\\n${pyramid}`;\n\t\t\t\t\tmessage += `\\n\\nIf you're only using the import as a type, change it to \\`import type\\`.`;\n\n\t\t\t\t\tthrow stackless(message);\n\t\t\t\t}\n\n\t\t\t\t// No chain from this server-only module to a client entrypoint was found —\n\t\t\t\t// the module is only imported from server code, which is valid.\n\t\t\t}\n\t\t},\n\n\t\t// avoid watch mode rebuilds using stale import map data\n\t\tbuildEnd() {\n\t\t\timport_map.clear();\n\t\t}\n\t};\n}\n","sourceCodeStart":186,"sourceCodeEnd":218,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/exports/vite/plugins/guard.js#L186-L218","documentation":"Error \"Cannot import ${normalized} into code that runs in the browser, as this could leak sensitive information.\\n\\n${pyramid}\\n\\nIf you're only using the import as a type, change it to `import type`.\" thrown in sveltejs/kit.","triggerScenarios":"Thrown at packages/kit/src/exports/vite/plugins/guard.js:204 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Move the browser-facing code so it no longer (transitively) imports the $lib/server or .server.js module","If the import is types-only, change it to `import type`","Split shared logic out of the server module into a neutral module both sides can import","Enable experimental.remoteFunctions if the import is a remote module used intentionally"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}