UNPKG

button-library-saturday-learning

Version:

this is description

58 lines (52 loc) 1.28 kB
import styles from "rollup-plugin-styles"; import autoprefixer from "autoprefixer"; import babel from "@rollup/plugin-babel"; import sourcemaps from "rollup-plugin-sourcemaps"; // the entry point for the library const input = "src/index.js"; // var MODE = [ { fomart: "cjs", //commonjs }, { fomart: "esm", //ECMAScript Modules }, { fomart: "umd", //universal module definition }, ]; var config = []; MODE.map((m) => { var conf = { input: input, output: { // then name of your package name: "button-library", file: `dist/index.${m.fomart}.js`, format: m.fomart, exports: "auto", interop: "auto", }, // this externelizes react to prevent rollup from compiling it external: ["react", /@babel\/runtime/], plugins: [ // these are babel comfigurations babel({ exclude: "node_modules/**", plugins: ["@babel/transform-runtime"], babelHelpers: "runtime", }), // this adds sourcemaps sourcemaps(), // this adds support for styles styles({ postcss: { plugins: [autoprefixer()], }, }), ], }; config.push(conf); }); export default [...config];