add stock sw.js

This commit is contained in:
David Reed 2022-09-30 21:38:25 -04:00
parent 79505c3a8c
commit 0cd779ffa2
2 changed files with 11 additions and 2 deletions

7
src/sw.js Normal file
View file

@ -0,0 +1,7 @@
importScripts('/uv.bundle.js');
importScripts('/uv.config.js');
importScripts('/uv.sw.js');
const sw = new UVServiceWorker();
self.addEventListener('fetch', (event) => event.respondWith(sw.fetch(event)));

View file

@ -2,7 +2,6 @@ import webpack from 'webpack';
import { fileURLToPath } from 'url';
import TerserPlugin from 'terser-webpack-plugin';
import CopyPlugin from 'copy-webpack-plugin';
import { resolve } from 'path';
const isDevelopment = process.env.NODE_ENV !== 'production';
@ -24,7 +23,7 @@ const config = {
minimize: !isDevelopment,
minimizer: [
new TerserPlugin({
exclude: ['uv.config.js'],
exclude: ['sw.js', 'uv.config.js'],
}),
],
},
@ -34,6 +33,9 @@ const config = {
{
from: fileURLToPath(new URL('./src/uv.config.js', import.meta.url)),
},
{
from: fileURLToPath(new URL('./src/sw.js', import.meta.url)),
},
],
}),
],