【发布时间】:2019-02-27 01:05:07
【问题描述】:
我最近开始使用 vs 代码。我正在使用带有反应和类型脚本的材料 ui。但我无法使用 alt(option) + enter 快捷方式导入材质 ui 的组件。我正在使用 mac,我使用的 typescript 版本是 3.0.3。但是,我明确创建的反应组件,我能够使用上述快捷方式导入的组件。以下是我正在使用的 package.json:
{
"name": "portfolio",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack"
},
"author": "ahujru",
"license": "ISC",
"dependencies": {
"@material-ui/core": "3.0.3",
"@material-ui/icons": "3.0.1",
"@types/material-ui": "0.21.5",
"@types/react": "16.4.14",
"@types/react-dom": "16.0.7",
"awesome-typescript-loader": "5.2.1",
"css-loader": "1.0.0",
"node-sass": "4.9.3",
"react": "16.5.1",
"react-dom": "16.5.1",
"sass": "1.13.4",
"sass-loader": "7.1.0",
"source-map-loader": "0.2.4",
"style-loader": "0.23.0",
"typeface-roboto": "0.0.54",
"typescript": "3.0.3",
"webpack": "4.19.0",
"webpack-cli": "3.1.0",
"webpack-dev-server": "3.1.8"
}
}
和 tsconfig.json:
{
"compilerOptions": {
"baseUrl": ".",
"module": "commonjs",
"watch": true,
"sourceMap": true,
"outDir": "target",
"target": "es6",
"jsx": "react",
"noImplicitAny": true,
"moduleResolution": "node"
},
"include": [
"./src/**/*"
],
"exclude": [
"node_modules"
]
}
我已经安装了 npm intellisense、intellij 键绑定和自动导入等插件,但似乎仍然没有任何反应。有人可以告诉我我在这里缺少什么。
【问题讨论】:
标签: reactjs typescript visual-studio-code material-ui