Installing peerDependencies of nested dependencies

Viewed 317

I have a project dependency structure like this:

Project A
   |_______>Webpack@^1.0.0
   |_______>Project B
               |_________>Webpack@^3.0.0
               |_________>extract-text-webpack-plugin@^3.0.1
                              |____________>has a peerDependency of webpack@^3.1.0

When I do npm install in Project A, this is my node_modules structure:

Project A/node_modules  ->  Webpack 1.15.0
                        ->  extract-text-webpack-plugin 3.0.2
                        ->  Project B
Project B/node_modules  ->  Webpack 3.12.0

Now if I try to use extract-text-webpack-plugin, it gives a webpack related error because its peer is Webpack 1.15.0 whereas it requires a peer dependency of webpack@^3.0.1.

How can I make sure that extract-text-webpack-plugin gets installed in Project B's node_modules where I have its peer dependency installed.

I tried using npm dedupe (https://docs.npmjs.com/cli/dedupe) in Project A to instead get Webpack 3.12.0 into Project A's node_modules folder, but it didnt move Webpack 3.12.0 outside.

Is there a way to handle this case?

0 Answers
Related