fdusautoir
173
6
Vue

Vue and alias

Posted 9 months ago by fdusautoir

Hi Everybody.

How can I have aliases in my vue files ? to prevent to use relative path everywhere ... That is not very convenient if I change the app structure in a future.

for example in my ./store/index.js I have in a function :

router.addRoutes([
    {
        path: '/clients',
        component: require('../../views/Clients.vue')
    }
]);
                

The best would be (as in Laravel) :

router.addRoutes([
    {
        path: '/clients',
        component: require(views_path('/Clients.vue'))
    }
]);

What is the best way to achieve that ?

Thanks for your help ! :)

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.