From a9bb724ae6be2988796424a6623f37d882bf0615 Mon Sep 17 00:00:00 2001 From: Arne Molland Date: Sun, 8 Aug 2021 15:57:35 +0200 Subject: [PATCH] Make library tree-shakeable --- package.json | 25 +++++++++++++++---------- rollup.config.js | 12 +++--------- src/hooks.ts | 1 + 3 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 src/hooks.ts diff --git a/package.json b/package.json index 547ebe3b..bc35edbd 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,8 @@ { "name": "@gameflow-tv/flume", - "version": "0.1.8", + "version": "0.2.0", "description": "React implementation of the Flume design system", - "main": "dist/index.js", - "module": "dist/index.es.js", + "module": "dist/index.js", "files": [ "dist" ], @@ -34,7 +33,11 @@ "pre-commit": "yarn format" } }, - "dependencies": { + "dependencies": {}, + "peerDependencies": { + "react": "^17.0.2", + "react-dom": "^17.0.2", + "styled-components": "^5.3.0", "@fortawesome/fontawesome-svg-core": "^1.2.36", "@fortawesome/free-brands-svg-icons": "^5.15.4", "@fortawesome/pro-light-svg-icons": "^5.15.4", @@ -43,11 +46,6 @@ "@fortawesome/react-fontawesome": "^0.1.15", "lodash": "^4.17.21" }, - "peerDependencies": { - "react": "^17.0.2", - "react-dom": "^17.0.2", - "styled-components": "^5.3.0" - }, "devDependencies": { "@mdx-js/loader": "^1.6.22", "@mdx-js/mdx": "^1.6.22", @@ -92,6 +90,13 @@ "storybook": "^6.3.6", "styled-components": "^5.3.0", "ts-jest": "^27.0.4", - "typescript": "^4.3.5" + "typescript": "^4.3.5", + "@fortawesome/fontawesome-svg-core": "^1.2.36", + "@fortawesome/free-brands-svg-icons": "^5.15.4", + "@fortawesome/pro-light-svg-icons": "^5.15.4", + "@fortawesome/pro-regular-svg-icons": "^5.15.4", + "@fortawesome/pro-solid-svg-icons": "^5.15.4", + "@fortawesome/react-fontawesome": "^0.1.15", + "lodash": "^4.17.21" } } diff --git a/rollup.config.js b/rollup.config.js index 56ed6fb5..475b87b4 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -4,19 +4,12 @@ import peerDepsExternal from "rollup-plugin-peer-deps-external" import typescript from "@rollup/plugin-typescript" import postcss from "rollup-plugin-postcss" -import pkg from "./package.json" - // eslint-disable-next-line import/no-anonymous-default-export export default { input: "./src/index.ts", output: [ { - file: pkg.main, - format: "cjs", - sourcemap: true - }, - { - file: pkg.module, + dir: "dist", format: "esm", sourcemap: true } @@ -27,5 +20,6 @@ export default { commonjs(), typescript(), postcss() - ] + ], + preserveModules: true, } \ No newline at end of file diff --git a/src/hooks.ts b/src/hooks.ts new file mode 100644 index 00000000..6471a97e --- /dev/null +++ b/src/hooks.ts @@ -0,0 +1 @@ +export * from './lib/hooks'