vue-axios: Can't import VueAxios in typescript
I’m trying to use vue-axios in typescript project but get errors even on import:
import VueAxios from 'vue-axios'; // has no default export.
import * as VueAxios from 'vue-axios'; // resolves to a non-module entity and cannot be imported using this construct.
import VueAxios = require('vue-axios'); // Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
import { VueAxios } from 'vue-axios'; // has no exported member 'VueAxios'.
Should consider VueAxios to be default export? Or there some other methods to import the plugin?
Versions: vue-axios: 2.1.1 typescript: 2.8.1
tsconfig.json:
{
"compilerOptions": {
"outDir": "./src/main/webapp/",
"sourceMap": true,
"noImplicitAny": false,
"module": "es2015",
"target": "es5",
"strict": true,
"jsx": "react",
"allowJs": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"skipLibCheck": true
}
}
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (5 by maintainers)
@imcvampire Still misses the part that allows calling axios on global Vue.
I’ve the same problem, using typescript 2.8.1 with webpack and
ts-loadertsconfig.json:
maybe you should change the export line for the type definition.
issue #24 fixes the import, but then loses the typing information for
Vue.axios