Skip to content

Commit

Permalink
Get non-app pages loading properly via vite
Browse files Browse the repository at this point in the history
  • Loading branch information
V13Axel committed Jul 4, 2024
1 parent 5eb295c commit 4587f38
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion resources/js/app-tw.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* building robust, powerful web applications using Vue and Laravel.
*/

require('./bootstrap-tw');
import './bootstrap-tw';
14 changes: 10 additions & 4 deletions resources/js/bootstrap-tw.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
window._ = require('lodash');
import _ from 'lodash';
window._ = _;

import Alpine from 'alpinejs'
window.Alpine = Alpine
Expand All @@ -10,7 +11,8 @@ Alpine.start()
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/

window.axios = require('axios');
import axios from 'axios';
window.axios = axios;

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
window.axios.defaults.withCredentials = true;
Expand Down Expand Up @@ -43,13 +45,17 @@ if (token) {
* API, allowing confirmations and very much more. (sweetalert.js.org)
*/

window.swal = require('sweetalert2')
import swal from 'sweetalert2';
window.swal = swal;


/**
* Sanitize HTML inputs browser-side using sanitize-html!
*/

window.sanitizeHtml = require('sanitize-html');
import sanitizeHtml from 'sanitize-html';
window.sanitizeHtml = sanitizeHtml;



/**
Expand Down
4 changes: 2 additions & 2 deletions resources/views/templates/_head_content_tw.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<script>window.bugsnagClient = bugsnag('98440cbeef759631f3d987ab45b26a79')</script>
@endif

<script src="{{ mix('/js/app-tw.js') }}" defer></script>
@vite('resources/js/app-tw.js')
@feature('stripe')
<script src="https://js.stripe.com/v3/"></script>
@endfeature
Expand Down Expand Up @@ -77,7 +77,7 @@ function deviceType() {
</script>

<link rel="stylesheet" href="{{ mix('css/app-tw.css') }}">
@vite('resources/sass/app-tw.css')

@stack('head')
</head>
2 changes: 1 addition & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const colors = require('tailwindcss/colors')
import colors from 'tailwindcss/colors';

module.exports = {
darkMode: 'class',
Expand Down

0 comments on commit 4587f38

Please sign in to comment.