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

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