Skip to content

Instantly share code, notes, and snippets.

@PatrickJS
Created May 8, 2024 18:10
Show Gist options
  • Save PatrickJS/458a65df6135ba0a94a103b2a3ea07ab to your computer and use it in GitHub Desktop.
Save PatrickJS/458a65df6135ba0a94a103b2a3ea07ab to your computer and use it in GitHub Desktop.
import { isBrowser } from '@builder.io/qwik/build';
serverOnly();
export function serverOnly() {
if (isBrowser) {
console.log('SERVER ONLY');
throw new Error(
'This module cannot be imported from the Client.' +
'It should only be used from the Server.',
);
}
}
export default serverOnly;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment