design system: minifies bundle, builds two target directories

This commit is contained in:
@wwwjim 2020-07-02 01:10:13 -07:00
parent 583cf46dcd
commit 6354546d60
3 changed files with 14 additions and 10865 deletions

10861
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -40,9 +40,10 @@
"ws": "^7.3.0" "ws": "^7.3.0"
}, },
"devDependencies": { "devDependencies": {
"@rollup/plugin-node-resolve": "^8.1.0",
"rollup": "^2.18.1", "rollup": "^2.18.1",
"rollup-plugin-babel": "^4.4.0", "rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-commonjs": "^10.1.0",
"@rollup/plugin-node-resolve": "^8.1.0" "rollup-plugin-terser": "^6.1.0"
} }
} }

View File

@ -1,14 +1,15 @@
import babel from "rollup-plugin-babel"; import babel from "rollup-plugin-babel";
import commonjs from "rollup-plugin-commonjs"; import commonjs from "rollup-plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve"; import resolve from "@rollup/plugin-node-resolve";
import { terser } from "rollup-plugin-terser";
const input = "./components/system/index.js"; const input = "./components/system/index.js";
export default [ const generateOutput = (outputPath) => {
{ return {
input, input,
output: { output: {
file: "dist/index.js", file: outputPath,
format: "cjs", format: "cjs",
}, },
external: ["@emotion/react", "react", "react-dom"], external: ["@emotion/react", "react", "react-dom"],
@ -38,6 +39,12 @@ export default [
"node_modules/react-tippy/dist/react-tippy.js": ["Tooltip"], "node_modules/react-tippy/dist/react-tippy.js": ["Tooltip"],
}, },
}), }),
terser(),
], ],
}, };
};
export default [
generateOutput("dist/index.js"),
generateOutput("../slate-react-system/src/index.js"),
]; ];