InversifyJS icon indicating copy to clipboard operation
InversifyJS copied to clipboard

inversify-vanillajs-helpers should have peer dependency on inversify

Open Xesenix opened this issue 7 years ago • 0 comments

When using inversify-vanillajs-helpers with webpack im seeing its being packed together with inversify adding unnecessary size: inversify_duplicate_00

Expected Behavior

After installing inversify-vanillajs-helpers I don't get inversify in its dependencies that is node_modules/inversify-vanillajs-helpers/node_modules/inversify should not exists.

Current Behavior

When installing inversify-vanillajs-helpers it has duplicate of inversify in node_modules/inversify-vanillajs-helpers/node_modules/inversify.

Possible Solution

package.json in inversify-vanillajs-helpers

{
  ...
  "peerDependencies": {
    "inversify": "^4.11.0"
  }
  ...
}

Although I am not sure if its enough for gulp build (for example in rollup you need to set it additionally as external library).

Alternative would be to use for example https://github.com/alexjoverm/typescript-library-starter and set externals in rollup to 'inversify'.

  external: [
    'inversify',
  ],

But this one would require rewriting library to use rollup.

Steps to Reproduce (for bugs)

I have noticed it when trying out it in https://github.com/Xesenix/webpack-3-scaffold/tree/DI

  1. clone https://github.com/Xesenix/webpack-3-scaffold/tree/DI
  2. npm install
  3. npm run demo:analyze - this will show module dependencies like on that screen above

Context

Unnecessary increases size of build. Also it requires inversify-vanillajs-helpers library update to sync with inversify currently its locked at 4.11.0.

Your Environment

node v9.6.1 npm 5.7.1 https://github.com/Xesenix/webpack-3-scaffold/tree/DI

Xesenix avatar Mar 17 '18 16:03 Xesenix