NPM package contains node_modules which conflicts with other packages

661 Views Asked by At

I am trying to get the latest version of the office-ui-fabric-react npm package to work with the latest version of the vss-web-extension-sdk npm package.

global npm packages:

+-- [email protected]
+-- [email protected]

package.json (dependencies only):

"dependencies": {
    "office-ui-fabric-react": "^6.103.0",
    "vss-web-extension-sdk": "^5.141.0"
},
"devDependencies": {
    "@types/react": "^16.7.3",
    "@types/react-dom": "^16.0.9"
}

tsconfig.json:

{
    "compilerOptions": {
        "module": "amd",
        "moduleResolution": "node",
        "target": "es6",
        "lib": ["es5", "es6", "dom"],
        "jsx": "react",
        "rootDir": "src/",
        "outDir": "dist/",
        "baseUrl": "./",
        "types": [ "react", "react-dom" ]
    }
}

When I run tsc -p . I get an error that it cannot find the modules necessary:

error TS2307: Cannot find module 'VSS/Controls/Navigation'.

If I add "vss-web-extension-sdk" to my tsconfig.json types, the module properly resolves, but compilation fails:

node_modules/vss-web-extension-sdk/node_modules/@types/react/index.d.ts:3668:13 - error TS2717: Subsequent property declarations must have the same type. Property 'div' must be of type 'DetailedHTMLProps, HTMLDivElement>', but here has type 'DetailedHTMLProps, HTMLDivElement>'.

It seems to me that it is failing perhaps because the @types/react found within the node_modules in vss-web-extension-sdk is conflicting with my @types/react found within my node_modules.

@types/react: // Type definitions for React 16.7
vss-web-extension-sdk/node_modules/@types/react: // Type definitions for React 15.6

I have tried to modify my tsconfig.json in numerous ways to no avail, and this is not an expert area of mine. How can I get these packages to play well with each other?

0

There are 0 best solutions below