question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Cannot find module` or `corresponding type declarations` of peer dependency -- needs to be installed as devDep as well

See original GitHub issue

What happens and why it is wrong

Rollup build failed when @material-ui/core is as peerDependency.

[!] (plugin rpt2) Error: //rollup-material-ui-peerDependencies-error/src/TestComponent/TestComponent.tsx(2,28): semantic error TS2307: Cannot find module '@material-ui/core' or its corresponding type declarations.

PS: I already saw this issue related (https://github.com/ezolenko/rollup-plugin-typescript2/issues/198) and the solution doesn’t fit for me. I’ve also opened a question on stackoverflow to explain all my research to find a solution for it. You can see it here: https://stackoverflow.com/questions/68581137/is-it-possible-to-have-material-ui-as-peerdependency-but-keep-its-types-as-devde


Environment

Here it is a replicated scenario: https://github.com/andrebnassis/rollup-material-ui-peerDependencies-error

  1. clone the repository
  2. yarn && yarn build Then the following error appears:
[!] (plugin rpt2) Error: //rollup-material-ui-peerDependencies-error/src/TestComponent/TestComponent.tsx(2,28): semantic error TS2307: Cannot find module '@material-ui/core' or its corresponding type declarations.
Versions
  npmPackages:
    rollup: ^2.36.1 => 2.55.1 
    rollup-plugin-typescript2: ^0.29.0 => 0.29.0 
    typescript: ^4.1.3 => 4.3.5 

rollup.config.js

`rollup.config.js`:
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "rollup-plugin-typescript2";
import postcss from "rollup-plugin-postcss";
import copy from "rollup-plugin-copy";

const packageJson = require("./package.json");

export default {
  input: "src/index.ts",
  output: [
    {
      file: packageJson.main,
      format: "cjs",
      sourcemap: true
    },
    {
      file: packageJson.module,
      format: "esm",
      sourcemap: true
    }
  ],
  plugins: [
    peerDepsExternal(),
    resolve(),
    commonjs(),
    typescript({ useTsconfigDeclarationDir: true, verbosity:3 }),
    postcss(),
    copy({
      targets: [
        {
          src: "src/variables.scss",
          dest: "build",
          rename: "variables.scss"
        },
        {
          src: "src/typography.scss",
          dest: "build",
          rename: "typography.scss"
        }
      ]
    })
  ],
  external:[
    "react",
    "react-dom",
    "@material-ui/core"
  ]
};

tsconfig.json

`tsconfig.json`:
{
  "compilerOptions": {
    "rootDir": "src",
    "declaration": true,
    "declarationDir": "build",
    "module": "esnext",
    "target": "es5",
    "lib": ["es6", "dom", "es2016", "es2017"],
    "sourceMap": true,
    "jsx": "react",
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true
  },
  "include": ["src/**/*"],
  "exclude": [
    "node_modules",
    "build",
    "storybook-static",
    "src/**/*.stories.tsx",
    "src/**/*.test.tsx"
  ]
}

package.json

`package.json`:
{
  "name": "react-component-library",
  "version": "1.0.0",
  "main": "build/index.js",
  "module": "build/index.esm.js",
  "files": [
    "build"
  ],
  "types": "build/index.d.ts",
  "description": "A skeleton to create your own React component library using Rollup, TypeScript, Sass and Storybook",
  "scripts": {
    "build": "rollup -c",
    "test": "jest",
    "test:watch": "jest --watch",
    "storybook": "start-storybook -p 6006",
    "storybook:export": "build-storybook",
    "generate": "node ./util/create-component",
    "prepublishOnly": "npm run build"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/HarveyD/react-component-library.git"
  },
  "keywords": [
    "React",
    "Component",
    "Library",
    "Rollup",
    "Typescript",
    "Sass",
    "Storybook"
  ],
  "author": "Harvey Delaney",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/HarveyD/react-component-library/issues"
  },
  "homepage": "https://github.com/HarveyD/react-component-library#readme",
  "peerDependencies": {
    "react": ">=16.8.0",
    "react-dom": ">=16.8.0",
    "@material-ui/core": "^4.12.3"
  },
  "devDependencies": {
    "@babel/core": "^7.12.10",
    "@rollup/plugin-commonjs": "^17.0.0",
    "@rollup/plugin-node-resolve": "^11.0.1",
    "@storybook/react": "^6.1.12",
    "@testing-library/jest-dom": "^5.5.0",
    "@testing-library/react": "^11.2.3",
    "@types/jest": "^24.0.24",
    "@types/react": "^16.9.12",
    "@types/react-dom": "^16.9.8",
    "babel-loader": "^8.1.0",
    "babel-preset-react-app": "^10.0.0",
    "identity-obj-proxy": "^3.0.0",
    "jest": "^26.6.3",
    "node-sass": "^5.0.0",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "rollup": "^2.36.1",
    "rollup-plugin-copy": "^3.3.0",
    "rollup-plugin-peer-deps-external": "^2.2.0",
    "rollup-plugin-postcss": "^3.1.2",
    "rollup-plugin-typescript2": "^0.29.0",
    "sass-loader": "^10.1.1",
    "ts-jest": "^26.4.4",
    "typescript": "^4.1.3"
  },
  "dependencies": {
  }
}

plugin output with verbosity 3

plugin output with verbosity 3:
rollup -c

src/index.ts → build/index.js, build/index.esm.js...
rpt2: built-in options overrides: {
    "noEmitHelpers": false,
    "importHelpers": true,
    "noResolve": false,
    "noEmit": false,
    "inlineSourceMap": false,
    "outDir": "/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/.cache/rollup-plugin-typescript2/placeholder",
    "moduleResolution": 2,
    "allowNonTsExtensions": true
}
rpt2: parsed tsconfig: {
    "options": {
        "rootDir": "/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src",
        "declaration": true,
        "declarationDir": "/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/build",
        "module": 99,
        "target": 1,
        "lib": [
            "lib.es2015.d.ts",
            "lib.dom.d.ts",
            "lib.es2016.d.ts",
            "lib.es2017.d.ts"
        ],
        "sourceMap": true,
        "jsx": 2,
        "moduleResolution": 2,
        "allowSyntheticDefaultImports": true,
        "esModuleInterop": true,
        "configFilePath": "/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/tsconfig.json",
        "noEmitHelpers": false,
        "importHelpers": true,
        "noResolve": false,
        "noEmit": false,
        "inlineSourceMap": false,
        "outDir": "/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/.cache/rollup-plugin-typescript2/placeholder",
        "allowNonTsExtensions": true
    },
    "fileNames": [
        "/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/index.ts",
        "/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/TestComponent/TestComponent.tsx",
        "/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/TestComponent/TestComponent.types.ts",
        "/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/TestComponent/index.ts"
    ],
    "typeAcquisition": {
        "enable": false,
        "include": [],
        "exclude": []
    },
    "raw": {
        "compilerOptions": {
            "rootDir": "src",
            "declaration": true,
            "declarationDir": "build",
            "module": "esnext",
            "target": "es5",
            "lib": [
                "es6",
                "dom",
                "es2016",
                "es2017"
            ],
            "sourceMap": true,
            "jsx": "react",
            "moduleResolution": "node",
            "allowSyntheticDefaultImports": true,
            "esModuleInterop": true
        },
        "include": [
            "src/**/*"
        ],
        "exclude": [
            "node_modules",
            "build",
            "storybook-static",
            "src/**/*.stories.tsx",
            "src/**/*.test.tsx"
        ],
        "compileOnSave": false
    },
    "errors": [],
    "wildcardDirectories": {
        "/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src": 1
    },
    "compileOnSave": false
}
rpt2: typescript version: 4.3.5
rpt2: tslib version: 2.0.1
rpt2: rollup version: 2.55.1
rpt2: rollup-plugin-typescript2 version: 0.29.0
rpt2: plugin options:
{
    "useTsconfigDeclarationDir": true,
    "verbosity": 3,
    "check": true,
    "clean": false,
    "cacheRoot": "/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/.cache/rollup-plugin-typescript2",
    "include": [
        "*.ts+(|x)",
        "**/*.ts+(|x)"
    ],
    "exclude": [
        "*.d.ts",
        "**/*.d.ts"
    ],
    "abortOnError": true,
    "rollupCommonJSResolveHack": false,
    "tsconfigOverride": {},
    "transformers": [],
    "tsconfigDefaults": {},
    "objectHashIgnoreUnknownHack": false,
    "cwd": "/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error",
    "typescript": "version 4.3.5"
}
rpt2: rollup config:
{
    "input": "src/index.ts",
    "plugins": [
        {
            "name": "peer-deps-external"
        },
        {
            "name": "node-resolve"
        },
        {
            "name": "commonjs"
        },
        {
            "name": "rpt2"
        },
        {
            "name": "postcss"
        },
        {
            "name": "copy"
        },
        {
            "name": "stdin"
        }
    ],
    "output": [
        {
            "file": "build/index.js",
            "format": "cjs",
            "plugins": [],
            "sourcemap": true
        },
        {
            "file": "build/index.esm.js",
            "format": "esm",
            "plugins": [],
            "sourcemap": true
        }
    ]
}
rpt2: tsconfig path: /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/tsconfig.json
rpt2: included:
[
    "*.ts+(|x)",
    "**/*.ts+(|x)"
]
rpt2: excluded:
[
    "*.d.ts",
    "**/*.d.ts"
]
rpt2: Ambient types:
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/aria-query/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/babel__core/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/babel__generator/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/babel__template/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/babel__traverse/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/braces/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/color-convert/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/color-name/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/estree/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/fs-extra/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/glob/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/glob-base/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/graceful-fs/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/hast/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/html-minifier-terser/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/is-function/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/istanbul-lib-coverage/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/istanbul-lib-report/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/istanbul-reports/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/jest/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/json-schema/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/markdown-to-jsx/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/mdast/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/micromatch/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/minimatch/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/node/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/node-fetch/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/normalize-package-data/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/npmlog/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/overlayscrollbars/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/parse-json/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/parse5/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/prettier/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/pretty-hrtime/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/prop-types/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/q/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/qs/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/reach__router/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/react/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/react-dom/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/react-syntax-highlighter/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/resolve/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/scheduler/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/source-list-map/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/stack-utils/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/tapable/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/testing-library__jest-dom/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/uglify-js/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/unist/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/webpack/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/webpack-env/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/webpack-sources/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/yargs/index.d.ts
rpt2:     /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/@types/yargs-parser/index.d.ts
rpt2: ambient types changed, redoing all semantic diagnostics
rpt2: transpiling '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/index.ts'
rpt2:     cache: '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/.cache/rollup-plugin-typescript2/rpt2_145486f490525aa885e64e8edf27cb541e65d0c8/code/cache/e05df8d76de9af07ab9b6def73df12d7eac5dadb'
rpt2:     cache miss
rpt2:     cache: '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/.cache/rollup-plugin-typescript2/rpt2_145486f490525aa885e64e8edf27cb541e65d0c8/syntacticDiagnostics/cache/e05df8d76de9af07ab9b6def73df12d7eac5dadb'
rpt2:     cache miss
rpt2:     cache: '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/.cache/rollup-plugin-typescript2/rpt2_145486f490525aa885e64e8edf27cb541e65d0c8/semanticDiagnostics/cache/e05df8d76de9af07ab9b6def73df12d7eac5dadb'
rpt2:     cache miss
rpt2: generated declarations for '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/index.ts'
rpt2: dependency '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/TestComponent/index.ts'
rpt2:     imported by '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/index.ts'
rpt2: resolving './TestComponent' imported by '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/index.ts'
rpt2:     to '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/TestComponent/index.ts'
rpt2: transpiling '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/TestComponent/index.ts'
rpt2:     cache: '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/.cache/rollup-plugin-typescript2/rpt2_145486f490525aa885e64e8edf27cb541e65d0c8/code/cache/10024918a8f4dd27e98df73f999774fc6bb9623f'
rpt2:     cache miss
rpt2:     cache: '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/.cache/rollup-plugin-typescript2/rpt2_145486f490525aa885e64e8edf27cb541e65d0c8/syntacticDiagnostics/cache/10024918a8f4dd27e98df73f999774fc6bb9623f'
rpt2:     cache miss
rpt2:     cache: '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/.cache/rollup-plugin-typescript2/rpt2_145486f490525aa885e64e8edf27cb541e65d0c8/semanticDiagnostics/cache/10024918a8f4dd27e98df73f999774fc6bb9623f'
rpt2:     cache miss
rpt2: generated declarations for '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/TestComponent/index.ts'
rpt2: dependency '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/TestComponent/TestComponent.tsx'
rpt2:     imported by '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/TestComponent/index.ts'
rpt2: resolving './TestComponent' imported by '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/TestComponent/index.ts'
rpt2:     to '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/TestComponent/TestComponent.tsx'
rpt2: transpiling '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/TestComponent/TestComponent.tsx'
rpt2:     cache: '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/.cache/rollup-plugin-typescript2/rpt2_145486f490525aa885e64e8edf27cb541e65d0c8/code/cache/4b0364bc4ff1d3bc060ae0b18227faa193943ab6'
rpt2:     cache miss
rpt2:     cache: '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/.cache/rollup-plugin-typescript2/rpt2_145486f490525aa885e64e8edf27cb541e65d0c8/syntacticDiagnostics/cache/4b0364bc4ff1d3bc060ae0b18227faa193943ab6'
rpt2:     cache miss
rpt2:     cache: '/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/.cache/rollup-plugin-typescript2/rpt2_145486f490525aa885e64e8edf27cb541e65d0c8/semanticDiagnostics/cache/4b0364bc4ff1d3bc060ae0b18227faa193943ab6'
rpt2:     cache miss
[!] (plugin rpt2) Error: /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/TestComponent/TestComponent.tsx(2,28): semantic error TS2307: Cannot find module '@material-ui/core' or its corresponding type declarations.
src/TestComponent/TestComponent.tsx
Error: /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/src/TestComponent/TestComponent.tsx(2,28): semantic error TS2307: Cannot find module '@material-ui/core' or its corresponding type declarations.
    at error (/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/rollup/dist/shared/rollup.js:151:30)
    at throwPluginError (/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/rollup/dist/shared/rollup.js:19340:12)
    at Object.error (/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/rollup/dist/shared/rollup.js:19992:20)
    at Object.error (/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/rollup/dist/shared/rollup.js:19516:38)
    at RollupContext.error (/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/rollup-plugin-typescript2/src/rollupcontext.ts:37:18)
    at /home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/rollup-plugin-typescript2/src/print-diagnostics.ts:41:11
    at arrayEach (/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/rollup-plugin-typescript2/node_modules/lodash/lodash.js:516:11)
    at Function._.each [as forEach] (/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/rollup-plugin-typescript2/node_modules/lodash/lodash.js:9368:14)
    at printDiagnostics (/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/rollup-plugin-typescript2/src/print-diagnostics.ts:9:2)
    at Object.transform (/home/andrebnassis/MyProjects/rollup-material-ui-peerDependencies-error/node_modules/rollup-plugin-typescript2/src/index.ts:244:5)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

5reactions
andrebnassiscommented, Aug 5, 2021

I solved this problem by setting all my peerDependencies as devDependencies (https://github.com/HarveyD/react-component-library/issues/40)

4reactions
artemis-primecommented, Jan 31, 2022

@andrebnassis That is NOT a solution. That is a workaround. How do you justify closing this!?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using a peer dependency in npm package - Stack Overflow
When I run "npm run build" I get an error in the terminal saying "Cannot find module 'moment'". I am currently testing the...
Read more >
A tip on using peer dependencies with TypeScript
I wanted to make this one a peer dependency as well, ... got the typical "Cannot find module or its corresponding type declarations"...
Read more >
What are peer dependencies in a Node module? - Flavio Copes
A simple explanation of the peerDependencies field in the package.json ... npm will warn you if you run npm install and it does...
Read more >
cannot find module 'fs' or its corresponding type declarations.
You need to include the definition file for node. TypeScript 2.0+. Install using npm: npm install --save-dev @ ...
Read more >
rollup.js
If you want to write your configuration as a CommonJS module using require and module.exports , you should change the file extension to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found