question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CDN import: TypeError: Cannot set property 'axios' of undefined

See original GitHub issue

I’m trying to use axios CDN with dynamic import ES6 ,

My code

(async ()=>{ await import('https://unpkg.com/axios/dist/axios.min.js') })()

Error

axios_type_error

It works fine with System.import , but not with native import,

Context

  • axios version: v0.18.0
  • Environment: chrome 70, windows 10

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
dfenerskicommented, Jul 13, 2021

Why is the issue closed when the bug is clearly reproducible and there is no proper fix even in the comments?

1reaction
haynajjarcommented, Oct 30, 2018

I just test it independently, this is the execution result on the console output_axios

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot set property 'axios' of undefined
Try adding the axios to the Vue instance. Read this for more details https://v2.vuejs.org/v2/cookbook/adding-instance-properties.html.
Read more >
cannot set properties of undefined (setting 'axios') - You.com
My code. (async ()=>{ await import('https://unpkg.com/axios/dist/axios.min.js') })() ; Error. axios_type_error. It works fine with System.import , but not with ...
Read more >
axios - npm
Start using axios in your project by running `npm i axios`. ... `true` - ignore JSON parsing errors and set response.data to null...
Read more >
cannot read properties of undefined react
Cannot read property 'setState' of undefined in react) TypeError: Cannot read ... import { useEffect, useState } from ' react'; import axios from...
Read more >
Typeerror: cannot read property '_id' of undefined - CodeProject
TypeError : Cannot read property '_id' of undefined at ... import { useEffect, useState } from 'react'; import axios from 'axios'; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found