Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

276
Visualizações
Modularize 'rollup.config' | "Error: Could not resolve 'path/to/module' from rollup.config.js"

I'm in the process of implementing rollup into my mono repo library for better bundling.

Issue

Since the library is a mono repo, I want to reuse build configurations for the individual packages. I've tried to do so by outsourcing methods that return specific build configurations(e.g. createCommonJsConfig(), createESMConfig()) into a file called rollup.default.config.ts which is located at the root of the mono repo.

These functions are then imported into the rollup.config.js file of each package to create the final rollup configuration.

// rollup.config.js of an individual package

import {
  createCommonJSConfig,
  createDeclarationConfig,
  createESMConfig,
} from '../rollup.config.default';

// https://rollupjs.org/guide/en/#configuration-files
export default function () {
  return [
    createDeclarationConfig(),
    createCommonJSConfig(),
    createESMConfig({ multiFileOutput: true }),
  ];
}

Unfortunately, as soon as I import the rollup.config.default.ts file into a rollup.config.js file of a package, I get this error:

[!] Error: Could not resolve '../rollup.config.default' from rollup.config.js

Question

Does anybody know whether it is possible to somehow modularize a rollup.config.js file to reuse commonly used parts.

  • repo: https://github.com/agile-ts/agile
  • rollup.default.config.ts: https://github.com/agile-ts/agile/blob/removing-internal/packages/rollup.config.default.ts

Thanks a lot ;D

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Resolved this issue by being consistent with my config file extension -> After I've transformed the rollup.default.config.ts file to a rollup.default.config.js file it worked as expected.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda