Visual Studio Code不会使用默认导出功能导入任何npm程序包。我正在使用ES6(无TS)
这是我的代码:
const apiURL = "https://localhost:8000";
frisby.globalSetup({
request: {
json: true,
baseUrl: apiURL,
},
});
axios.defaults.baseURL = apiURL;
axios.defaults.headers.post['Content-Type'] = 'application/json';
当我写frisby时,它并不建议导入,并且ctrl+.
也不起作用
我的package.json有这个:
{
"name": "ApiTest",
"version": "1.0.0",
"description": "",
"main": "index.js",
"author": "Luis",
"license": "MIT",
"scripts": {
"test": "jest"
},
"devDependencies": {
"@babel/core": "^7.3.3",
"@babel/preset-env": "^7.3.1",
"@types/frisby": "^2.0.5",
"@types/jest": "^24.0.6",
"babel-jest": "^24.1.0",
"eslint": "^5.14.1",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.16.0",
"faker": "^4.1.0",
"frisby": "^2.1.1",
"jest": "^24.1.0"
},
"dependencies": {
"axios": "^0.18.0",
"dotenv": "^6.2.0"
}
}
我希望VSCode建议我导入
import axios from 'axios';
import frisby from 'frisby';
我安装了auto import
和npm intellisense
,但对我不起作用,我该怎么办?