Module '…' resolves to a non-module entity and cannot be imported using this construct

喜你入骨 提交于 2019-12-08 15:12:15

问题


I have a .tsx file in which I am trying to import a RaisedButton component from material-ui like so:

import * as RaisedButton from 'material-ui/lib/raised-button'

However, that gives me the error described in the title, any ideas what I might be doing wrong?


回答1:


This is from the material-ui.d.ts file.

export import RaisedButton = __MaterialUI.RaisedButton; // require('material-ui/lib/raised-button');

So you should import it like this.

import RaisedButton = require('material-ui/lib/raised-button');


来源:https://stackoverflow.com/questions/35277354/module-resolves-to-a-non-module-entity-and-cannot-be-imported-using-this-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!