0

I have created laravel setup and trying to configure vue js. for that i wrote code in app.js file

import Vue from 'vue';

import VueRouter from 'vue-router';
Vue.use(VueRouter);

import VueAxios from 'vue-axios';
import axios from 'axios';
Vue.use(VueAxios, axios);

import App from './App.vue';
import CreateItem from './CreateItem.vue';
import DisplayItem from './DisplayItem.vue';
import EditItem from './EditItem.vue';

But it's giving me in chrome error like: Uncaught SyntaxError: Unexpected token import

and in firefox it is giving error like : import declarations may only appear at top level of a module

1

1 Answer 1

1

You should keep your import at the top of your file, like this :

import Vue from 'vue';
import VueRouter from 'vue-router';
import VueAxios from 'vue-axios';
import axios from 'axios';


import App from './App.vue';
import CreateItem from './CreateItem.vue';
import DisplayItem from './DisplayItem.vue';
import EditItem from './EditItem.vue';

Vue.use(VueRouter);
Vue.use(VueAxios, axios);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.