09
Aug
import.meta.url. For JavaScript modules, you can use the import.meta object to access its own meta information. import.meta - JavaScript | MDN Therefore, <script type="module" src="app.js?someURLInfo=5"></script> Enter fullscreen mode Exit fullscreen mode At this time, app.js module is able to get its own URL with query parameters and hash through import.meta.url.In other words, You can pass values via query parameters like new URL(import.meta.url).searchParams.get('someURLInfo') // '5'; Enter fullscreen mode Exit fullscreen mode Using with Laravel Vite Normally you would use @vite directive to load js file like @vite('resources/js/app.js') Enter fullscreen mode Exit fullscreen mode so to pass a value through query parameter,…