Build the ServiceWorker with Vite
This commit is contained in:
parent
ba22fed03c
commit
dcad4bb4f7
3 changed files with 859 additions and 10 deletions
|
@ -210,6 +210,7 @@
|
||||||
"stylelint-config-standard-scss": "^6.1.0",
|
"stylelint-config-standard-scss": "^6.1.0",
|
||||||
"tailwindcss": "^3.3.3",
|
"tailwindcss": "^3.3.3",
|
||||||
"ts-jest": "^29.0.0",
|
"ts-jest": "^29.0.0",
|
||||||
|
"vite-plugin-pwa": "^0.16.5",
|
||||||
"yargs": "^17.6.2"
|
"yargs": "^17.6.2"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import react from '@vitejs/plugin-react';
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import compileTime from 'vite-plugin-compile-time';
|
import compileTime from 'vite-plugin-compile-time';
|
||||||
import { createHtmlPlugin } from 'vite-plugin-html';
|
import { createHtmlPlugin } from 'vite-plugin-html';
|
||||||
|
import { VitePWA } from 'vite-plugin-pwa';
|
||||||
import vitePluginRequire from 'vite-plugin-require';
|
import vitePluginRequire from 'vite-plugin-require';
|
||||||
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
vitePluginRequire.default(),
|
vitePluginRequire.default(),
|
||||||
|
compileTime(),
|
||||||
createHtmlPlugin({
|
createHtmlPlugin({
|
||||||
template: 'index.html',
|
template: 'index.html',
|
||||||
}),
|
}),
|
||||||
|
@ -38,7 +40,25 @@ export default defineConfig({
|
||||||
configFile: './babel.config.cjs',
|
configFile: './babel.config.cjs',
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
compileTime(),
|
VitePWA({
|
||||||
|
injectRegister: null,
|
||||||
|
strategies: 'injectManifest',
|
||||||
|
injectManifest: {
|
||||||
|
injectionPoint: undefined,
|
||||||
|
plugins: [
|
||||||
|
// @ts-ignore
|
||||||
|
compileTime(),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
manifestFilename: 'manifest.json',
|
||||||
|
manifest: {
|
||||||
|
name: 'Soapbox',
|
||||||
|
short_name: 'Soapbox',
|
||||||
|
description: 'A social media frontend with a focus on custom branding and ease of use.',
|
||||||
|
},
|
||||||
|
srcDir: 'soapbox/service-worker',
|
||||||
|
filename: 'sw.ts',
|
||||||
|
}),
|
||||||
viteStaticCopy({
|
viteStaticCopy({
|
||||||
targets: [{
|
targets: [{
|
||||||
src: '../node_modules/twemoji/assets/svg/*',
|
src: '../node_modules/twemoji/assets/svg/*',
|
||||||
|
|
Loading…
Reference in a new issue