Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

232
Vistas
Compile shared code from remote repository

I have 2 projects, 1 project shared , there I store some files, which I want to reuse between projects, I have also project where I want to use this shared repo, I install it by using package.json, in next way

  "dependencies": {
    "shared": "git+https://username:token@git.domain.com/project/shared.git"
   }

then it is installed in node_modules, it is ok until you don't check bundle size , it isn't optimized code, and webpack doesn't optimize it . I've tried to use some minimizers in shared repo for bebel compilation to make files size smaller, but it doesn't work a lot, here is the config :

module.exports = function(api) {
  api.cache(true)

  const presets = ['@babel/preset-env', '@babel/preset-react', 'minify']
  const plugins = [
    [
      'module-resolver',
      {
        root: ['./src']
      }
    ]
  ]

  return {
    presets,
    plugins
  }
}

Can I optimize it by using webpack in second project, or maybe there is some better way to make optimization in shared repository directly?

Also I use peer deps for preventing size increasing:

  "peerDependencies": {
    "@material-ui/core": "4.5.2",
    "prop-types": "15.7.2",
    "react": "16.11.0",
    "react-dom": "16.11.0",
    "react-helmet-async": "1.0.7",
    "react-redux": "7.1.3",
    "redux": "4.0.4",
    "redux-form": "8.2.6",
    "reselect": "4.0.0"
  },

Also included only what need:

 "files": [
    "hooks",
    "utils",
    "constants",
    "components",
    "reducers",
    "actions",
    "selectors",
    "README.md"
  ]

in package.json file.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda