Skip to content

Commit 5a87981

Browse files
authored
Merge pull request #21 from devguru99/dev
Dev
2 parents 57fecec + 57c52dc commit 5a87981

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

public/robots.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
user-agent: *
1+
User-agent: *
2+
Allow: /
23
disallow: /downloads/

src/main.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,8 @@ Promise.all([import('@/Root'), import('@/App')]).then(([{ default: render }, { d
1313
// Register the service worker
1414
if ('serviceWorker' in navigator) {
1515
window.addEventListener('load', () => {
16-
navigator.serviceWorker.register('/registerSW.js')
17-
.then(registration => {
18-
console.log('ServiceWorker registration successful with scope: ', registration.scope);
19-
})
20-
.catch(error => {
21-
console.log('ServiceWorker registration failed: ', error);
22-
});
23-
});
16+
navigator.serviceWorker.register('/sw.js', { scope: '/' })
17+
})
2418
}
2519

2620
export {};

vite.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ export default defineConfig({
1515
react(),
1616
VitePWA({
1717
manifest,
18+
injectRegister: 'auto',
1819
includeAssets: ['favicon.svg', 'favicon.ico', 'robots.txt', 'apple-touch-icon.png'],
1920
// switch to "true" to enable sw on development
2021
devOptions: {
22+
navigateFallbackAllowlist: [/^index.html$/],
2123
enabled: false,
2224
},
2325
workbox: {
2426
globPatterns: ['**/*.{js,css,html}', '**/*.{svg,png,jpg,gif}'],
25-
navigateFallback: './index.html',
27+
navigateFallback: '/index.html',
2628
},
2729
}),
2830
],

0 commit comments

Comments
 (0)