Skip to content

Commit

Permalink
Reduce bundle size (#252)
Browse files Browse the repository at this point in the history
* Add cross-env to fix windows build

* Use clsx intead of classnames

* Add babel-plugin-optimize-clsx

* Drop mui v3 support

* Remove redundant

* Fixes #251 - Fix bug with custom variant classes prop
  • Loading branch information
iamhosseindhv authored Apr 20, 2020
1 parent a014471 commit 84a57a0
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 46 deletions.
1 change: 1 addition & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"@babel/preset-react"
],
"plugins": [
"babel-plugin-optimize-clsx",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread"
],
Expand Down
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
Thanks to all contributers who improved notistack by opening an issue/PR.

### `[email protected].10`
### `[email protected].12`
###### to be published
* **@pctestjfarz**: Add swipe to dismiss feature [#138](https://github.com/iamhosseindhv/notistack/issues/138)
* **@molynerd**: Add support to update content of snackbar in place [#50](https://github.com/iamhosseindhv/notistack/issues/50)
* **@david-chau**: Allow `asc`, `desc` or custom sort order of snackbars [#160](https://github.com/iamhosseindhv/notistack/issues/160)

<br />

### `[email protected]`
###### April 20, 2020
* **@mehmetkose @andrewmclagan @oliviertassinari @merceyz**: Reduce Bundle size by using `clsx` instead of `classnames`, Use `babel-plugin-optimize-clsx` [#163](https://github.com/iamhosseindhv/notistack/issues/163)
* **@kikoanis** Fix bug with custom variant `classes` [#251](https://github.com/iamhosseindhv/notistack/issues/251)
* Drop support for Material UI v3



<br />

### `[email protected]`
###### April 17, 2020
* Migrate codebase to typescript.


<br />

Expand Down
188 changes: 175 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"scripts": {
"types": "tsc",
"build": "NODE_ENV=production BABEL_ENV=production babel src -d build --copy-files --extensions \".js,.ts,.tsx\"",
"build": "cross-env NODE_ENV=production BABEL_ENV=production babel src -d build --copy-files --extensions \".js,.ts,.tsx\"",
"prebuild": "rimraf build && npm run docs",
"prepublishOnly": "npm run build",
"docs": "rimraf typedoc.json && typedoc --tsconfig",
Expand All @@ -26,7 +26,7 @@
"peerDependencies": {
"react": "^16.8.0",
"react-dom": "^16.8.0",
"@material-ui/core": "^3.2.0 || ^4.0.0"
"@material-ui/core": "^4.0.0"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
Expand All @@ -37,15 +37,16 @@
"@babel/preset-react": "^7.8.3",
"@babel/preset-typescript": "^7.8.3",
"@material-ui/core": "^4.9.5",
"@types/classnames": "^2.2.10",
"@types/node": "^13.9.0",
"@types/react": "^16.9.23",
"@types/react-dom": "^16.9.5",
"@types/react-is": "^16.7.1",
"@typescript-eslint/eslint-plugin": "^2.22.0",
"@typescript-eslint/parser": "^2.22.0",
"babel-eslint": "^8.2.6",
"babel-plugin-optimize-clsx": "^2.6.0",
"babel-runtime": "^6.26.0",
"cross-env": "^7.0.2",
"eslint": "^6.1.0",
"eslint-config-airbnb": "~16.1.0",
"eslint-plugin-import": "~2.9.0",
Expand All @@ -58,7 +59,7 @@
"typescript": "^3.8.3"
},
"dependencies": {
"classnames": "^2.2.6",
"clsx": "^1.1.0",
"hoist-non-react-statics": "^3.3.0",
"react-is": "^16.8.6"
},
Expand Down
4 changes: 2 additions & 2 deletions src/SnackbarContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import classNames from 'classnames';
import clsx from 'clsx';
import { makeStyles } from '@material-ui/core/styles';
import { SNACKBAR_INDENTS } from './utils/constants';
import { SnackbarProviderProps } from '.';
Expand Down Expand Up @@ -57,7 +57,7 @@ const SnackbarContainer: React.FC<SnackbarContainerProps> = (props) => {
const classes = useStyle();
const { className, anchorOrigin, dense, ...other } = props;

const combinedClassname = classNames(
const combinedClassname = clsx(
classes.root,
classes[anchorOrigin.vertical],
classes[anchorOrigin.horizontal],
Expand Down
Loading

0 comments on commit 84a57a0

Please sign in to comment.