DEV Community

Discussion on: History Mode for vue-router in Laravel Environment

Collapse
 
prashanth1k profile image
Prashanth Krishnamurthy

Sure. If you have to import a view in router - you normally do a static import the view at the beginning of the code and use the view name in the router.

The above code is a simple dynamic import. The view is loaded dynamically when it is needed. This can tree-shake a bit and make your initial download faster.

See vuejs.org/v2/guide/components-dyna...

I have updated one more point about using a default route.

Thread Thread
 
raghunathan profile image
Raghunathan Srinivasan

I've done everthing you said. I am still not able to get rid of the hash.

Thread Thread
 
raghunathan profile image
Raghunathan Srinivasan

Normally, without using Laravel, history mode does work. In a Laravel based environment, it doesn't

Thread Thread
 
prashanth1k profile image
Prashanth Krishnamurthy

Ah.. ok.
I follow a client/server-api pattern and probably gave that problem a miss. See if dev.to/mozartted/bullet-proofed-ro... helps.