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

233
Visualizações
Optimize repository size before using it like a shared repository
  "scripts": {
    "compile": "cross-env NODE_ENV=production babel src --out-dir ."
  },

   "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"
  },

strong text

babel.config.js

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
  }
}

enter image description here

Above you can see files structure, package.json and babel configurations , before pushing it to repository , I do npm run compile , it compile files from src folder to root, then I push it to repository, below you can see how I install it in other project

 "dependencies": {
    "shared": "git+https://usernma:token@git.allnewsmartadmin.com/project/shared.git",
    }

then when I need some code from shared , I do import someModule from 'shared/action/someModule.js' . All is great , but by using it in this way , my bundle size increated a lot , and increased vendor.js file, because webpack detect really massive node_modules module . How can I compile it to make code in shared repository be as much small as it possible with bable ?

about 4 years ago · Juan Pablo Isaza
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