mirror of
https://github.com/titaniumnetwork-dev/Ultraviolet.git
synced 2025-05-13 12:00:01 -04:00
add stock sw.js
This commit is contained in:
parent
79505c3a8c
commit
0cd779ffa2
2 changed files with 11 additions and 2 deletions
7
src/sw.js
Normal file
7
src/sw.js
Normal 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)));
|
|
@ -2,7 +2,6 @@ import webpack from 'webpack';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import TerserPlugin from 'terser-webpack-plugin';
|
import TerserPlugin from 'terser-webpack-plugin';
|
||||||
import CopyPlugin from 'copy-webpack-plugin';
|
import CopyPlugin from 'copy-webpack-plugin';
|
||||||
import { resolve } from 'path';
|
|
||||||
|
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
|
@ -24,7 +23,7 @@ const config = {
|
||||||
minimize: !isDevelopment,
|
minimize: !isDevelopment,
|
||||||
minimizer: [
|
minimizer: [
|
||||||
new TerserPlugin({
|
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/uv.config.js', import.meta.url)),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
from: fileURLToPath(new URL('./src/sw.js', import.meta.url)),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue