fix(web_serviceworker): Move service worker initialization to init.ts and remove exports from service worker entrypoint to avoid ESM bundle output
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## 2025-12-04 - 6.8.1 - fix(web_serviceworker)
|
||||
Move service worker initialization to init.ts and remove exports from service worker entrypoint to avoid ESM bundle output
|
||||
|
||||
- Remove exports from ts_web_serviceworker/index.ts so the service worker entrypoint does not export symbols (prevents tsbundle from producing ESM output).
|
||||
- Add ts_web_serviceworker/init.ts which initializes the ServiceWorker instance and exports getServiceWorkerInstance() for internal imports.
|
||||
- Update ts_web_serviceworker/classes.dashboard.ts to import getServiceWorkerInstance from init.ts instead of index.ts.
|
||||
|
||||
## 2025-12-04 - 6.8.0 - feat(swdash)
|
||||
Add SW-Dash (Lit-based service worker dashboard), bundle & serve it; improve servertools and static handlers
|
||||
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@api.global/typedserver',
|
||||
version: '6.8.0',
|
||||
version: '6.8.1',
|
||||
description: 'A TypeScript-based project for easy serving of static files with support for live reloading, compression, and typed requests.'
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getMetricsCollector } from './classes.metrics.js';
|
||||
import { getServiceWorkerInstance } from './index.js';
|
||||
import { getServiceWorkerInstance } from './init.js';
|
||||
import * as interfaces from './env.js';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
// TypeScript declatations
|
||||
import * as env from './env.js';
|
||||
declare var self: env.ServiceWindow;
|
||||
|
||||
import { ServiceWorker } from './classes.serviceworker.js';
|
||||
|
||||
const sw = new ServiceWorker(self);
|
||||
|
||||
// Export getter for service worker instance (used by dashboard for TypedSocket access)
|
||||
export const getServiceWorkerInstance = (): ServiceWorker => sw;
|
||||
// Service worker entry point - NO EXPORTS here!
|
||||
// Exports at entry point cause tsbundle to output ESM format which service workers can't use.
|
||||
// The actual initialization happens in init.ts which other modules can import from.
|
||||
import './init.js';
|
||||
|
||||
10
ts_web_serviceworker/init.ts
Normal file
10
ts_web_serviceworker/init.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
// Service worker initialization - creates and exports the SW instance
|
||||
// Other modules in the bundle can import from here
|
||||
import * as env from './env.js';
|
||||
declare var self: env.ServiceWindow;
|
||||
|
||||
import { ServiceWorker } from './classes.serviceworker.js';
|
||||
|
||||
const sw = new ServiceWorker(self);
|
||||
|
||||
export const getServiceWorkerInstance = (): ServiceWorker => sw;
|
||||
Reference in New Issue
Block a user