Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsc fails with many "Cannot find module '../../../../material-ui/src/....'" errors #24271

Closed
2 tasks done
Philipp91 opened this issue Jan 4, 2021 · 3 comments
Closed
2 tasks done
Labels
duplicate This issue or pull request already exists

Comments

@Philipp91
Copy link
Contributor

Philipp91 commented Jan 4, 2021

  • The issue is present in the latest alpha release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

Two example errors:

node_modules/@material-ui/lab/internal/svg-icons/Calendar.d.ts:1:32 - error TS2307: Cannot find module '../../../../material-ui/src/OverridableComponent' or its corresponding type declarations.

1 declare const _default: import("../../../../material-ui/src/OverridableComponent").OverridableComponent<import("../../../../material-ui/src").SvgIconTypeMap<{}, "svg">>;
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@material-ui/lab/internal/svg-icons/Pen.d.ts:1:32 - error TS2307: Cannot find module '../../../../material-ui/src/OverridableComponent' or its corresponding type declarations.

1 declare const _default: import("../../../../material-ui/src/OverridableComponent").OverridableComponent<import("../../../../material-ui/src").SvgIconTypeMap<{}, "svg">>;
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expected Behavior 🤔

No error. Though note that this only affects the .d.ts file, so the application compiles and runs just fine with webpack.

Steps to Reproduce 🕹

Compile the project with tsc. I couldn't find a way to call tsc on codesandbox.io.

Context 🔦

The code pushed to NPM indeed contains that path:

npm pack @material-ui/[email protected]
tar --extract --file=material-ui-lab-5.0.0-alpha.22.tgz package/internal/svg-icons/Pen.d.ts -O
declare const _default: import("../../../../material-ui/src/OverridableComponent").OverridableComponent<import("../../../../material-ui/src").SvgIconTypeMap<{}, "svg">>;
/**
 * @ignore - internal component.
 */
export default _default;

When unpacked, ../../../../material-ui resolves to ./node_modules/material-ui, which indeed does not exist. I guess there's some config where material-ui needs to be replaced with @material-ui/core. Or maybe this is applied when packaging the library even though it shouldn't be? Or maybe this needs to do something smarter than just copy?

Your Environment 🌎

`npx @material-ui/envinfo`
  System:
    OS: Linux 4.4 Ubuntu 18.04.5 LTS (Bionic Beaver)
    CPU: (4) x64 Intel(R) Core(TM) i5-6400 CPU @ 2.70GHz
    Memory: 1.94 GB / 15.94 GB
    Container: Yes
    Shell: 5.4.2 - /usr/bin/zsh
  Binaries:
    Node: 14.0.0 - ~/.nvm/versions/node/v14.0.0/bin/node
    Yarn: 1.10.1 - /usr/bin/yarn
    npm: 6.14.10 - ~/.nvm/versions/node/v14.0.0/bin/npm
  Managers:
    Apt: 1.6.12 - /usr/bin/apt
    Composer: 2.0.8 - /usr/local/bin/composer
  Utilities:
    CMake: 3.10.2 - /usr/bin/cmake
    Make: 4.1 - /usr/bin/make
    GCC: 7.5.0 - /usr/bin/gcc
    Git: 2.17.1 - /usr/bin/git
  Servers:
    Apache: 2.4.29 - /usr/sbin/apachectl
  IDEs:
    Nano: 2.9.3 - /bin/nano
    Vim: 8.0 - /usr/bin/vim
  Languages:
    Bash: 4.4.20 - /bin/bash
    Java: 13.0.1 - /usr/bin/javac
    Perl: 5.26.1 - /usr/bin/perl
    PHP: 7.4.13 - /usr/bin/php
    Python: 2.7.17 - /usr/bin/python
    Python3: 3.6.9 - /usr/bin/python3
  Databases:
    MySQL: 5.7.32 - /usr/bin/mysql
@Philipp91 Philipp91 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 4, 2021
@Philipp91
Copy link
Contributor Author

This might be happening because I'm doing this:

import PenIcon from '@material-ui/lab/internal/svg-icons/Pen';

@oliviertassinari oliviertassinari removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 4, 2021
@oliviertassinari
Copy link
Member

Duplicate of #24112

@oliviertassinari oliviertassinari marked this as a duplicate of #24112 Jan 4, 2021
@github-actions github-actions bot added the duplicate This issue or pull request already exists label Jan 4, 2021
@Philipp91
Copy link
Contributor Author

Thanks, sorry for not finding it (maybe because it reported the same issue for material-ui-styles instead of the core package?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants