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

232
Views
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
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!