Reputation: 1818
I would like to know how I can use APP_URL from my .env file in the layout. Currently, I have the following.
<!-- Styles -->
<link rel="stylesheet" href="{{ asset(mix('css/styles.css')) }}">
<!-- Javascript -->
<script src="{{mix('js/app.js')}}"></script>
webpack.mix.js
const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');
// Styles
mix.sass('resources/scss/styles.scss', 'public/css')
.options({
postCss: [ tailwindcss('./tailwind.config.js') ],
});
// Javascript [Dashboard]
mix.js('resources/js/app.js', 'public/js/app.js')
.vue();
However, when I run npm run prod
and push on my server, the layout would always load like the following.
GET https://localhost:8080/css/styles.css net::ERR_CONNECTION_REFUSED2023:19
GET https://localhost:8080/js/app.js net::ERR_CONNECTION_REFUSED
I set in my .env:
APP_URL=myurl.com
But the website would like to load localhost:8080 again. I use laravel-mix 6.0.27
Upvotes: 1
Views: 1400