Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
91
rated 0 times [  95] [ 4]  / answers: 1 / hits: 7332  / 4 Years ago, tue, december 15, 2020, 12:00:00

I'm trying to make a chrome extension and I wanted to use the axios package. When I try to test my code in chrome I get this error.
I've installed the package by executing npm install axios in the console. Sorry if this is a rudimentary question, I don't really know what I am doing. Thanks for the help!


More From » node.js

 Answers
2

External modules like axios would need to be bundled into your chrome extension in order for it to work as you intend. You can use a bundler like webpack in order to do this, but there is a decent amount of configuration needed to get up and running.


I would recommend using the fetch API as an alternative. It's already freely available in chrome extensions and works in very similar way to axios.


A fuller code example comparing fetch to axios:
https://blog.logrocket.com/axios-or-fetch-api/


[#2115] Friday, December 11, 2020, 4 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
malkajillc

Total Points: 652
Total Questions: 107
Total Answers: 98

Location: Finland
Member since Sat, Nov 6, 2021
3 Years ago
malkajillc questions
Tue, Jun 29, 21, 00:00, 3 Years ago
Fri, Aug 21, 20, 00:00, 4 Years ago
Tue, Aug 11, 20, 00:00, 4 Years ago
Tue, Apr 14, 20, 00:00, 4 Years ago
;