Skip to content

Commit

Permalink
revert some changes to minimize diff
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen committed Jan 23, 2025
1 parent dbbda36 commit cd1eb06
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions flow-server/src/main/resources/vite.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import settings from '#settingsImport#';
import {
AssetInfo,
ChunkInfo,
build,
defineConfig,
mergeConfig,
OutputOptions,
PluginOption,
build,
UserConfigFn,
InlineConfig
InlineConfig,
UserConfigFn
} from 'vite';
import { getManifest, type ManifestTransform } from 'workbox-build';

Expand Down Expand Up @@ -117,8 +117,9 @@ function injectManifestToSWPlugin(): rollup.Plugin {
};
}

function buildSWPlugin(): PluginOption {
function buildSWPlugin(opts: { devMode: boolean }): PluginOption {
let buildConfig: InlineConfig;
const devMode = opts.devMode;

return {
name: 'vaadin:build-sw',
Expand Down Expand Up @@ -152,12 +153,12 @@ function buildSWPlugin(): PluginOption {
};
},
async buildStart() {
if (buildConfig.mode === 'development') {
if (devMode) {
await build(buildConfig);
}
},
async closeBundle() {
if (buildConfig.mode !== 'development') {
if (!devMode) {
await build({
...buildConfig,
plugins: [injectManifestToSWPlugin(), brotli()]
Expand Down Expand Up @@ -726,7 +727,7 @@ export const vaadinConfig: UserConfigFn = (env) => {
productionMode && brotli(),
devMode && vaadinBundlesPlugin(),
devMode && showRecompileReason(),
settings.offlineEnabled && buildSWPlugin(),
settings.offlineEnabled && buildSWPlugin({ devMode }),
!devMode && statsExtracterPlugin(),
!productionMode && preserveUsageStats(),
themePlugin({ devMode }),
Expand Down

0 comments on commit cd1eb06

Please sign in to comment.