same here.
vite-plugin-pwa with Laravel not registering Service Worker
Hello,
I'm trying to use PWA Vite Plugin (https://vite-pwa-org.netlify.app/) with Laravel (using "vite-plugin-laravel") and it's impossible for me to register the Service Worker.
This is my actual vite.config.js file:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
import { VitePWA } from 'vite-plugin-pwa';
export default defineConfig({
plugins: [
laravel({
input: [
'resources/js/app.js'
],
refresh: true,
}),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
VitePWA({
registerType: 'autoUpdate',
injectRegister: 'script',
}),
],
});
Then, on my HTML entry point I have defined this to register the Service Worker:
<script src="/build/registerSW.js"></script>
I'm using Laravel Valet trought HTTPS to access the App on my machine.
I think it must be something with the VitePWA option buildBase as mentioned here:
https://github.com/vite-pwa/vite-plugin-pwa/blob/main/src/types.ts#L158
It has to be defined to integrate with vite-plugin-laravel, but I tried everything with no luck :(
Can anyone help me with this?
Thanks a lot!!
Please or to participate in this conversation.