Skip to content

Commit

Permalink
fix: package exports fixes (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
amje authored Jan 30, 2023
1 parent 564fe5f commit b1579f7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
23 changes: 20 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,26 @@
"type": "git",
"url": "https://github.com/gravity-ui/uikit"
},
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"types": "build/esm/index.d.ts",
"exports": {
".": {
"require": "./build/cjs/index.js",
"import": "./build/esm/index.js"
},
"./*": {
"require": "./build/cjs/*.js",
"import": "./build/esm/*.js"
},
"./styles/*": "./styles/*"
},
"main": "./build/cjs/index.js",
"module": "./build/esm/index.js",
"types": "./index.d.ts",
"typesVersions": {
"*": {
"*": ["./build/esm/*"],
"index.d.ts": ["./build/esm/index.d.ts"]
}
},
"sideEffects": [
"*.css",
"*.scss"
Expand Down
3 changes: 2 additions & 1 deletion src/toaster-singleton-react-18.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ import {ToasterSingleton} from './components/Toaster/ToasterSingleton';
ToasterSingleton.injectReactDOMClient(ReactDOMClient);

// in SSR case
export const toaster = typeof window === 'object' ? new ToasterSingleton() : null;
export const toaster =
typeof window === 'object' ? new ToasterSingleton() : ({} as ToasterSingleton);
3 changes: 2 additions & 1 deletion src/toaster-singleton.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {ToasterSingleton} from './components/Toaster/ToasterSingleton';

// in SSR case
export const toaster = typeof window === 'object' ? new ToasterSingleton() : null;
export const toaster =
typeof window === 'object' ? new ToasterSingleton() : ({} as ToasterSingleton);

0 comments on commit b1579f7

Please sign in to comment.