2020-07-02 09:38:39 +03:00
|
|
|
import babel from "rollup-plugin-babel";
|
|
|
|
import commonjs from "rollup-plugin-commonjs";
|
|
|
|
import resolve from "@rollup/plugin-node-resolve";
|
2020-07-02 11:10:13 +03:00
|
|
|
import { terser } from "rollup-plugin-terser";
|
2020-07-07 11:35:08 +03:00
|
|
|
import json from "@rollup/plugin-json";
|
2020-07-02 09:38:39 +03:00
|
|
|
|
|
|
|
const input = "./components/system/index.js";
|
|
|
|
|
2020-07-02 11:10:13 +03:00
|
|
|
const generateOutput = (outputPath) => {
|
|
|
|
return {
|
2020-07-02 09:38:39 +03:00
|
|
|
input,
|
|
|
|
output: {
|
2020-07-02 11:10:13 +03:00
|
|
|
file: outputPath,
|
2020-07-02 09:38:39 +03:00
|
|
|
format: "cjs",
|
|
|
|
},
|
2020-07-02 10:13:55 +03:00
|
|
|
external: ["@emotion/react", "react", "react-dom"],
|
2020-07-02 09:38:39 +03:00
|
|
|
plugins: [
|
2020-07-07 11:35:08 +03:00
|
|
|
json({ exclude: ["node_modules/**"], compact: true }),
|
2020-07-02 09:38:39 +03:00
|
|
|
babel({
|
2020-07-07 11:35:08 +03:00
|
|
|
exclude: ["node_modules/**", "**/*.json"],
|
2020-07-02 09:38:39 +03:00
|
|
|
runtimeHelpers: true,
|
|
|
|
}),
|
|
|
|
resolve(),
|
|
|
|
commonjs({
|
|
|
|
// NOTE(jim): Solution here fixed it.
|
|
|
|
// https://github.com/styled-components/styled-components/issues/1654
|
|
|
|
namedExports: {
|
|
|
|
"node_modules/react/index.js": [
|
|
|
|
"cloneElement",
|
|
|
|
"createContext",
|
|
|
|
"Component",
|
|
|
|
"createElement",
|
|
|
|
"forwardRef",
|
|
|
|
"useContext",
|
|
|
|
"Fragment",
|
|
|
|
"useRef",
|
|
|
|
"useLayoutEffect",
|
|
|
|
"PureComponent",
|
|
|
|
],
|
|
|
|
"node_modules/react-dom/index.js": ["render", "hydrate"],
|
|
|
|
},
|
|
|
|
}),
|
2020-07-02 11:10:13 +03:00
|
|
|
terser(),
|
2020-07-02 09:38:39 +03:00
|
|
|
],
|
2020-07-02 11:10:13 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-08-16 04:39:00 +03:00
|
|
|
export default [generateOutput("dist/index.js"), generateOutput("../slate-react-system/src/index.js")];
|