Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

189
Views
Create multiple projects via Rollup.js

I'm building a component library using React, Typescript, Tailwind.

my site structure is setup like so:

src
--components
---- index.ts -> imports all the components
--icons
---- index.ts -> imports all the icons
--index.ts -> imports the components/icons

rollup.config.js
tsconfig.json

rollup.config.js

import url from "@rollup/plugin-url";
import typescript from "rollup-plugin-typescript2";
import pkg from "./package.json";
import postcss from "rollup-plugin-postcss";
import copy from "rollup-plugin-copy";
import commonJs from "@rollup/plugin-commonjs";

const config = {
  plugins: [
    url(),
    commonJs(),
    typescript(),
    postcss({
      config: {
        path: "./postcss.config.js",
      },
      extensions: [".css"],
      extract: true,
      minimize: true,
      plugins: [require("postcss-import")],
    }),
    copy({
      targets: [
        {
          src: ["src/assets/fonts/*.woff", "src/assets/fonts/*.woff2"],
          dest: "dist/fonts",
        },
      ],
    }),
  ],
  external: ["react", "react-dom", "react/jsx-runtime", "classnames"],
};

const es = {
  ...config,
  input: "src/index.ts",
  output: {
    format: "esm",
    preserveModules: true,
    dir: "dist/es",
  },
};

const cjs = {
  ...config,
  input: "src/index.ts",
  output: {
    format: "cjs",
    file: pkg.module,
  },
};

const umd = {
  ...config,
  input: "src/index.ts",
  output: {
    name: "DesignSystem",
    format: "umd",
    file: pkg.browser,
  },
};

export default [cjs, es, umd];

This is all working and building and I'm able to import into my project

import { Button, ArrowLeft } from "@myApp/my-design-system";

But what I'm wanting to do is split the Icons out into a separate import eg

import { Button } from "@myApp/my-design-system";
import { ArrowLeft } from "@myApp/my-design-system/icons";

But have tried multi entry points in rollup which works but the import has to go all the way to the folder which I'm not wanting to happen.

import { ArrowLeft } from "@myApp/my-design-system/dist/es/icons";
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!