From 2e3563d9aa0ad4ff46412c51d70ab6b8c5e80068 Mon Sep 17 00:00:00 2001 From: Jess Archer Date: Sat, 28 May 2022 10:36:33 +1000 Subject: [PATCH] Switch to ESM imports (#5895) This improves the transition for Vite users. --- resources/js/app.js | 2 +- resources/js/bootstrap.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/resources/js/app.js b/resources/js/app.js index 40c55f65..e59d6a0a 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1 +1 @@ -require('./bootstrap'); +import './bootstrap'; diff --git a/resources/js/bootstrap.js b/resources/js/bootstrap.js index 69225776..bbcdba42 100644 --- a/resources/js/bootstrap.js +++ b/resources/js/bootstrap.js @@ -1,4 +1,5 @@ -window._ = require('lodash'); +import _ from 'lodash'; +window._ = _; /** * We'll load the axios HTTP library which allows us to easily issue requests @@ -6,7 +7,8 @@ window._ = require('lodash'); * 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'; @@ -18,7 +20,8 @@ window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; // import Echo from 'laravel-echo'; -// window.Pusher = require('pusher-js'); +// import Pusher from 'pusher-js'; +// window.Pusher = Pusher; // window.Echo = new Echo({ // broadcaster: 'pusher',