我最近开始使用 VS Code。我正在使用带有 React 和 Type 脚本的 Material ui。但我无法使用 alt(option) + Enter 快捷方式导入 Material 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 keybindings 和 auto import 等插件,但似乎仍然没有发生任何事情。有人可以告诉我我在这里缺少什么吗?