samedi 31 juillet 2021

Migrate Laravel/Vue (laravel-mix) to production

I'm trying to move assets from localhost to production, the problem is that function mix is adding "//localhost:8080" in production, after running npm run production on my local machine.

My master.blade.php:

...
<link rel="stylesheet" href="">
</head>

<body class="">
  <div id="app"></div>

  <script src=""></script>
  <script src=""></script>
  <script src=""></script>
</body>
...

But on localhost is fine after npm run production:

...
<script src="/js/manifest.js?id=d3d86536d111c156f3bf"></script>
<script src="/js/vendor.js?id=4f7200a4a1dcf3c99f20"></script>
<script src="/js/app.js?id=5984cd10858ad9eb49c3"></script>
...

But in production it stays:

<script src="//localhost:8080/js/manifest.js"></script>
<script src="//localhost:8080/js/vendor.js"></script>
<script src="//localhost:8080/js/app.js"></script>

And my .env file:

APP_NAME=Laravel
APP_ENV=production
APP_KEY=base64:iEid8NZ4ponMoI6fitOLyZBoVNOTB4LWzgin6TIsGA0=
APP_DEBUG=true
APP_URL=https://www.my-url.com
...

My steps are:

  1. Execute npm run production (on my local)
  2. Move by FTP the public/js, public/css and mix-manifest.json to production env

My main problem is not knowing how to tell mix function I have already run the production command and how do I make it identify the right files in production (generated with npm run production).



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire