ERROR Failed to compile with 1 errors 10:52:35
error in ./node_modules/axios/lib/platform/index.js
Module parse failed: Unexpected token (5:2)
You may need an appropriate loader to handle this file type.
|
| export default {
| ...utils,
| ...platform
| }
@ ./node_modules/axios/lib/defaults/index.js 8:0-44
@ ./node_modules/axios/lib/axios.js
@ ./node_modules/axios/index.js
@ ./src/js/main.js
@ multi (webpack)-dev-server/client?http://localhost:81 webpack/hot/dev-server ./src/js/main.js
1. 执行下面的安装(注意axios版本要和自己的项目匹配)
npm uninstall axios
npm install axios@0.19.0 --save
2. vue 中 main.js 引入
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/css/global.css'
import axios from 'axios'
Vue.prototype.$axios = axios
Vue.use(ElementUI)
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
render: h => h(App)
})