Skip to content

Commit

Permalink
feat(DEV-13): migrate serviceworker to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
hhimanshu committed Jul 7, 2021
1 parent 2ecdc01 commit 03e961c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/service-worker.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/service-worker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { precacheAndRoute } from 'workbox-precaching';

// https://stackoverflow.com/questions/56356655/structuring-a-typescript-project-with-workers
declare const self: ServiceWorkerGlobalScope;
export {};

precacheAndRoute(self.__WB_MANIFEST);
console.log('Hello from service-worker.js');
3 changes: 1 addition & 2 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ module.exports = {
new CopyPlugin({
patterns: [
{ from: 'src/manifest.json', to: './' },
{ from: 'src/service-worker.js', to: './service-worker.js' },
{ from: 'src/icons/manifest', to: './' },
],
}),
new InjectManifest({
swSrc: './src/service-worker.js',
swSrc: './src/service-worker.ts',
}),
],
output: {
Expand Down

0 comments on commit 03e961c

Please sign in to comment.