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

131
Views
Issue with building typescript react component as node package

Trying to make a node package that will extract my react component that is written in typescript.

  1. Created a component
  2. Exported that component in /src/index.ts file
  3. setup roullup config
  4. run yarn build

Result: Console Error:

./src/index.ts → dist/index.ts, dist/index.es.ts...
[!] Error: Could not resolve './components/GeneralSectionForm' from src/index.ts
Error: Could not resolve './components/GeneralSectionForm' from src/index.ts

This is rollup config

import babel from 'rollup-plugin-babel';
import resolve from '@rollup/plugin-node-resolve';
import external from 'rollup-plugin-peer-deps-external';
import { terser } from 'rollup-plugin-terser';
import postcss from 'rollup-plugin-postcss';
import reactSvg from "rollup-plugin-react-svg";

export default [
  {
    input: './src/index.ts',
    output: [
      {
        file: 'dist/index.ts',
        format: 'cjs',
      },
      {
        file: 'dist/index.es.ts',
        format: 'es',
        exports: 'named',
      }
    ],
    plugins: [
      postcss({
        plugins: [],
        minimize: true,
      }),
      babel({
        exclude: 'node_modules/**',
        presets: ['@babel/preset-react']
      }),
      external(),
      resolve(),
      terser(),
      reactSvg({
        svgo: {
          plugins: [], // passed to svgo
          multipass: true
        },
        // whether to output jsx
        jsx: false,
        // include: string
        include: ["src/custom.d.ts"],
        // exclude: string
        exclude: null
      })
    ]
  }
];

src/index.ts

export * from './components/GeneralSectionForm';

I assume that issue is cus src/index.ts is not the javascript type of file, does anyone know how to set up this to work with a typescript file?

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!