I installed axios-jsonp, but the error saids there is no jsonpAdapter. Could someone help me?
I use Vue.js and I want to get data from API.
error: Require statement not part of import statement.
export default defineComponent({
setup() {
const jsonpAdapter = require("axios-jsonp");
const getProductList = async (inputValue: string) => {
const appId = <myappId>;
axios({
url:
"https://shopping.yahooapis.jp/ShoppingWebService/V3/itemSearch?appid=" +
appId +
"&query=" +
inputValue,
adapter: jsonpAdapter,
});
};
package.json
"packages": {
"": {
"name": "vue3-sales-app",
"version": "0.1.0",
"dependencies": {
"axios": "^1.2.2",
"core-js": "^3.8.3",
"jsonp": "^0.1.0",
"vue": "^3.2.13",
"vue-router": "^4.0.3",
"vuex": "^4.0.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"@vue/cli-plugin-babel": "^5.0.8",
"@vue/cli-plugin-eslint": "^5.0.8",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-typescript": "^5.0.8",
"@vue/cli-plugin-vuex": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"@vue/eslint-config-typescript": "^9.1.0",
"axios-jsonp": "^1.0.4",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.0.3",
"prettier": "^2.4.1",
"typescript": "~4.5.5"
}
},
I tried npm install axios-jsonp
Log:
$npm install axios-jsonp
added 392 packages, changed 1 package, and audited 1024 packages in 5s
112 packages are looking for funding run
npm fundfor details15 low severity vulnerabilities
To address all issues possible (including breaking changes), run:
npm audit fix --forceSome issues need review, and may require choosing a different dependency.
Run
npm auditfor details.