prateekbh / preact-material-components

preact wrapper for "Material Components for the web"
https://material.preactjs.com
MIT License
553 stars 81 forks source link

Failed build after import anything #1310

Closed alegargar closed 5 years ago

alegargar commented 5 years ago

After install this, the project builds correctly, but at the moment I try using any component the build fails. For example, importing the Button, using or not using it after the import.

import Button from 'preact-material-components/Button';
import 'preact-material-components/Button.css';
ERROR in  {_the .tsx where I imported_}
Module not found: Error: Can't resolve 'preact-material-components/Button.css' in '/{...}'
 @ {other_file_path}.tsx 12:0-47
...
ERROR in [at-loader] ./node_modules/preact-material-components/Base/MaterialComponent.d.ts:1:26 
    TS7016: Could not find a declaration file for module '@material/base/component'. '{path}/node_modules/@material/base/component.js' implicitly has an 'any' type.
  Try `npm install @types/material__base` if it exists or add a new declaration (d.ts) file containing `declare module 'material__base';`

ERROR in [at-loader] ./node_modules/preact-material-components/Base/MaterialComponent.d.ts:2:27 
    TS7016: Could not find a declaration file for module '@material/ripple'. '{path}/node_modules/@material/ripple/index.js' implicitly has an 'any' type.
  Try `npm install @types/material__ripple` if it exists or add a new declaration (.d.ts) file containing `declare module 'material__ripple';`
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
cromefire commented 5 years ago

If I remember correctly you have to import preact-material-components/Button/styles.css instead of preact-material-components/Button.css

@material sadly has no typing (at least in that Version) so that's nothing we can fix

cromefire commented 5 years ago

Did that work for you?