Skip to content
Permalink
Browse files
feat: introduce code splitting to component library
  • Loading branch information
HarveyD committed Apr 29, 2020
1 parent 1bcf738 commit 94631be5a871f3b39dbc3e9bd3e75a8ae5b3b759
Showing 4 changed files with 9 additions and 13 deletions.
@@ -2,7 +2,6 @@
"name": "react-component-library",
"version": "1.0.0",
"main": "build/index.js",
"module": "build/index.esm.js",
"files": [
"build"
],
@@ -1,26 +1,20 @@
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "rollup-plugin-typescript2";
import sass from "rollup-plugin-sass";
import copy from "rollup-plugin-copy";

import packageJson from "./package.json";

export default {
input: "src/index.ts",
input: ["src/index.ts", "src/TestComponent/index.ts"],
output: [
{
file: packageJson.main,
dir: "build",
format: "cjs",
sourcemap: true
},
{
file: packageJson.module,
format: "esm",
sourcemap: true
}
],
preserveModules: true, // Important if we want to code split
plugins: [
peerDepsExternal(),
resolve(),
@@ -0,0 +1,3 @@
import TestComponent from "./TestComponent";

export default TestComponent;
@@ -1,3 +1,3 @@
import TestComponent from "./TestComponent/TestComponent";
import TestComponent from "./TestComponent";

export { TestComponent };

0 comments on commit 94631be

Please sign in to comment.