slate/rollup.config.js

43 lines
996 B
JavaScript
Raw Normal View History

2020-11-26 03:19:51 +03:00
import babel from "@rollup/plugin-babel";
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import json from "@rollup/plugin-json";
2020-11-26 04:41:19 +03:00
import visualizer from "rollup-plugin-visualizer";
import { terser } from "rollup-plugin-terser";
const input = "./components/system/index.js";
const generateOutput = (outputPath) => {
return {
input,
output: {
file: outputPath,
format: "cjs",
},
2020-11-26 02:53:25 +03:00
external: ["react", "react-dom", "node-fetch"],
plugins: [
json({ exclude: ["node_modules/**"], compact: true }),
babel({
exclude: ["node_modules/**", "**/*.json"],
2020-11-26 03:19:51 +03:00
babelHelpers: "runtime",
}),
2020-11-26 04:41:19 +03:00
resolve({
preferBuiltins: false,
}),
2020-11-26 03:19:51 +03:00
commonjs(),
2020-11-26 04:41:19 +03:00
terser({
format: {
comments: false,
},
}),
visualizer(),
],
};
};
export default [
generateOutput("dist/index.js"),
generateOutput("../slate-react-system/src/index.js"),
];