diff options
Diffstat (limited to 'subprojects/frontend')
-rw-r--r-- | subprojects/frontend/.eslintrc.cjs | 2 | ||||
-rw-r--r-- | subprojects/frontend/build.gradle | 4 | ||||
-rw-r--r-- | subprojects/frontend/src/RegisterServiceWorker.tsx | 3 | ||||
-rw-r--r-- | subprojects/frontend/vite.config.ts | 7 |
4 files changed, 14 insertions, 2 deletions
diff --git a/subprojects/frontend/.eslintrc.cjs b/subprojects/frontend/.eslintrc.cjs index 68636f4e..625aab7a 100644 --- a/subprojects/frontend/.eslintrc.cjs +++ b/subprojects/frontend/.eslintrc.cjs | |||
@@ -36,7 +36,7 @@ module.exports = { | |||
36 | env: { | 36 | env: { |
37 | browser: true, | 37 | browser: true, |
38 | }, | 38 | }, |
39 | ignorePatterns: ['build/**/*'], | 39 | ignorePatterns: ['build/**/*', 'dev-dist/**/*'], |
40 | rules: { | 40 | rules: { |
41 | // In typescript, some class methods implementing an inderface do not use `this`: | 41 | // In typescript, some class methods implementing an inderface do not use `this`: |
42 | // https://github.com/typescript-eslint/typescript-eslint/issues/1103 | 42 | // https://github.com/typescript-eslint/typescript-eslint/issues/1103 |
diff --git a/subprojects/frontend/build.gradle b/subprojects/frontend/build.gradle index da237411..dd50860c 100644 --- a/subprojects/frontend/build.gradle +++ b/subprojects/frontend/build.gradle | |||
@@ -93,6 +93,10 @@ tasks.register('serveFrontend', RunYarn) { | |||
93 | description = 'Start a Vite dev server with hot module replacement.' | 93 | description = 'Start a Vite dev server with hot module replacement.' |
94 | } | 94 | } |
95 | 95 | ||
96 | tasks.named('clean') { | ||
97 | delete 'dev-dist' | ||
98 | } | ||
99 | |||
96 | sonarqube.properties { | 100 | sonarqube.properties { |
97 | properties['sonar.sources'] += ['src'] | 101 | properties['sonar.sources'] += ['src'] |
98 | property 'sonar.nodejs.executable', "${frontend.nodeInstallDirectory.get()}/bin/node" | 102 | property 'sonar.nodejs.executable', "${frontend.nodeInstallDirectory.get()}/bin/node" |
diff --git a/subprojects/frontend/src/RegisterServiceWorker.tsx b/subprojects/frontend/src/RegisterServiceWorker.tsx index c9b2e353..5f46bc3d 100644 --- a/subprojects/frontend/src/RegisterServiceWorker.tsx +++ b/subprojects/frontend/src/RegisterServiceWorker.tsx | |||
@@ -50,7 +50,8 @@ function UpdateSnackbarActions({ | |||
50 | export default function RegisterServiceWorker(): null { | 50 | export default function RegisterServiceWorker(): null { |
51 | const { enqueueSnackbar, closeSnackbar } = useSnackbar(); | 51 | const { enqueueSnackbar, closeSnackbar } = useSnackbar(); |
52 | useEffect(() => { | 52 | useEffect(() => { |
53 | if (import.meta.env.DEV) { | 53 | if (window.location.host === 'localhost') { |
54 | // Do not register service worker during local development. | ||
54 | return; | 55 | return; |
55 | } | 56 | } |
56 | if (!('serviceWorker' in navigator)) { | 57 | if (!('serviceWorker' in navigator)) { |
diff --git a/subprojects/frontend/vite.config.ts b/subprojects/frontend/vite.config.ts index 7c0c2605..bb421788 100644 --- a/subprojects/frontend/vite.config.ts +++ b/subprojects/frontend/vite.config.ts | |||
@@ -66,6 +66,12 @@ export default defineConfig({ | |||
66 | strategies: 'generateSW', | 66 | strategies: 'generateSW', |
67 | registerType: 'prompt', | 67 | registerType: 'prompt', |
68 | injectRegister: null, | 68 | injectRegister: null, |
69 | devOptions: { | ||
70 | enabled: true, | ||
71 | }, | ||
72 | // Unregister service worker installed in production mode | ||
73 | // if Vite is started in development mode on the same domain. | ||
74 | selfDestroying: isDevelopment, | ||
69 | workbox: { | 75 | workbox: { |
70 | globPatterns: [ | 76 | globPatterns: [ |
71 | '**/*.{css,html,js}', | 77 | '**/*.{css,html,js}', |
@@ -74,6 +80,7 @@ export default defineConfig({ | |||
74 | ], | 80 | ], |
75 | dontCacheBustURLsMatching: /\.(?:css|js|woff2?)$/, | 81 | dontCacheBustURLsMatching: /\.(?:css|js|woff2?)$/, |
76 | navigateFallbackDenylist: [/^\/xtext-service/], | 82 | navigateFallbackDenylist: [/^\/xtext-service/], |
83 | sourcemap: isDevelopment, | ||
77 | }, | 84 | }, |
78 | includeAssets: ['apple-touch-icon.png', 'favicon.svg', 'mask-icon.svg'], | 85 | includeAssets: ['apple-touch-icon.png', 'favicon.svg', 'mask-icon.svg'], |
79 | manifest: { | 86 | manifest: { |