Home » Php » php laravel/vuejs deployment my vuejs views are not rendering

php laravel/vuejs deployment my vuejs views are not rendering

Posted by: admin October 29, 2018 Leave a comment

Questions:

I have a project using laravel 5.5 and vuejs 2.5.7.
Everything is working fine on localhost but on production,my vuejs components are not rendering.
All my request are fine, i have only 200.
I have done npm run production and set the app.js files into my folder public_html/js

I have two folders one public with the js files and the index.php
and an other with my ressources, the node-modules and the vendor.

my home page:

<!DOCTYPE html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">

<title>{{ config('app.name', 'AlphaTeen') }}</title>

<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<link href="{{ asset('css/main.css') }}" rel="stylesheet">
<link href="{{asset('css/bootstrap-social.css')}}" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font- 
awesome.min.css" rel="font-awesome">

</head>
<body>

    @yield('content')
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}"></script>//after having done npm run 
production
</body>
</html>

my php file:

@extends('layouts.vue_app')

@section('content')

<div id="products"></div>
<script>
        window.Laravel=<?php echo json_encode([
            'csrfToken'=> csrf_token(),
        ]); ?>
        </script>
@endsection

my app.js files who’s rendering the route:

window.onload=function(){
const router=new VueRouter({mode:'history',routes:routes});
new Vue(Vue.util.extend({router},App)).$mount('#products');};

i have done all the transfers with ftp, i know that is not the best solution but i have to.
This is my first question on stackOverFlow so i hope having be enough clear.
Thanks

Answers: