mirror of
https://github.com/robonen/tools.git
synced 2026-03-20 10:54:44 +00:00
feat(packages/platform): add global isClient util and build config
This commit is contained in:
9
packages/platform/build.config.ts
Normal file
9
packages/platform/build.config.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { defineBuildConfig } from 'unbuild';
|
||||
|
||||
export default defineBuildConfig({
|
||||
rollup: {
|
||||
esbuild: {
|
||||
// minify: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
1
packages/platform/src/index.ts
Normal file
1
packages/platform/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './multi';
|
||||
@@ -17,3 +17,12 @@ export const _global =
|
||||
: typeof self !== 'undefined'
|
||||
? self
|
||||
: undefined;
|
||||
|
||||
/**
|
||||
* @name isClient
|
||||
* @category Multi
|
||||
* @description Check if the current environment is the client
|
||||
*
|
||||
* @since 0.0.2
|
||||
*/
|
||||
export const isClient = typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"extends": "@robonen/tsconfig/tsconfig.json"
|
||||
"extends": "@robonen/tsconfig/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["DOM"]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user