Revert "fix vite web build to work with subpath"

This reverts commit 1a9f36ce9e.
This commit is contained in:
jeffvli
2026-02-12 18:17:44 -08:00
parent 80292ae579
commit 96f5b2b82a
4 changed files with 120 additions and 139 deletions
+116 -122
View File
@@ -4,132 +4,126 @@ import { defineConfig, normalizePath } from 'vite';
import { ViteEjsPlugin } from 'vite-plugin-ejs';
import { VitePWA } from 'vite-plugin-pwa';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export default defineConfig(({ mode }) => {
const base = process.env.VITE_BASE_PATH || '/';
return {
base,
build: {
emptyOutDir: true,
outDir: path.resolve(__dirname, './out/web'),
rollupOptions: {
input: {
'32x32': normalizePath(path.resolve(__dirname, './assets/icons/32x32.png')),
'64x64': normalizePath(path.resolve(__dirname, './assets/icons/64x64.png')),
'128x128': normalizePath(path.resolve(__dirname, './assets/icons/128x128.png')),
'256x256': normalizePath(path.resolve(__dirname, './assets/icons/256x256.png')),
'512x512': normalizePath(path.resolve(__dirname, './assets/icons/512x512.png')),
'1024x1024': normalizePath(
path.resolve(__dirname, './assets/icons/1024x1024.png'),
),
favicon: normalizePath(path.resolve(__dirname, './assets/icons/favicon.ico')),
index: normalizePath(path.resolve(__dirname, './src/renderer/index.html')),
preview_full_screen_player: normalizePath(
path.resolve(__dirname, './media/preview_full_screen_player.webp'),
),
},
},
sourcemap: true,
},
css: {
modules: {
generateScopedName: 'fs-[name]-[local]',
localsConvention: 'camelCase',
export default defineConfig({
base: '/',
build: {
emptyOutDir: true,
outDir: path.resolve(__dirname, './out/web'),
rollupOptions: {
input: {
'32x32': normalizePath(path.resolve(__dirname, './assets/icons/32x32.png')),
'64x64': normalizePath(path.resolve(__dirname, './assets/icons/64x64.png')),
'128x128': normalizePath(path.resolve(__dirname, './assets/icons/128x128.png')),
'256x256': normalizePath(path.resolve(__dirname, './assets/icons/256x256.png')),
'512x512': normalizePath(path.resolve(__dirname, './assets/icons/512x512.png')),
'1024x1024': normalizePath(path.resolve(__dirname, './assets/icons/1024x1024.png')),
favicon: normalizePath(path.resolve(__dirname, './assets/icons/favicon.ico')),
index: normalizePath(path.resolve(__dirname, './src/renderer/index.html')),
preview_full_screen_player: normalizePath(
path.resolve(__dirname, './media/preview_full_screen_player.webp'),
),
},
},
optimizeDeps: {
exclude: [
'@atlaskit/pragmatic-drag-and-drop',
'@atlaskit/pragmatic-drag-and-drop-auto-scroll',
'@atlaskit/pragmatic-drag-and-drop-hitbox',
'@tanstack/react-query-persist-client',
'idb-keyval',
],
sourcemap: true,
},
css: {
modules: {
generateScopedName: 'fs-[name]-[local]',
localsConvention: 'camelCase',
},
plugins: [
react(),
ViteEjsPlugin({
root: normalizePath(path.resolve(__dirname, './src/renderer')),
web: true,
}),
VitePWA({
devOptions: {
// The PWA will not be shown during development
enabled: false,
},
filename: 'sw.js',
injectRegister: 'inline',
manifest: {
background_color: '#FFDCB5',
display: 'standalone',
icons: [
{
sizes: '32x32',
src: '32x32.png',
type: 'image/png',
},
{
sizes: '64x64',
src: '64x64.png',
type: 'image/png',
},
{
sizes: '128x128',
src: '128x128.png',
type: 'image/png',
},
{
sizes: '256x256',
src: '256x256.png',
type: 'image/png',
},
{
purpose: 'any',
sizes: '512x512',
src: '512x512.png',
type: 'image/png',
},
{
sizes: '1024x1024',
src: '1024x1024.png',
type: 'image/png',
},
],
name: 'Feishin',
orientation: 'portrait',
screenshots: [
{
form_factor: 'wide',
label: 'Full screen player showing music player and lyrics',
sizes: '720x450',
src: 'preview_full_screen_player.webp',
type: 'image/webp',
},
],
short_name: 'Feishin',
start_url: '.',
theme_color: '#1E003D',
},
manifestFilename: 'assets/manifest.webmanifest',
outDir: path.resolve(__dirname, './out/web/'),
registerType: 'autoUpdate',
workbox: {
cleanupOutdatedCaches: true,
clientsClaim: true,
maximumFileSizeToCacheInBytes: 1000000 * 5, // 5 MB
skipWaiting: true,
},
}),
},
optimizeDeps: {
exclude: [
'@atlaskit/pragmatic-drag-and-drop',
'@atlaskit/pragmatic-drag-and-drop-auto-scroll',
'@atlaskit/pragmatic-drag-and-drop-hitbox',
'@tanstack/react-query-persist-client',
'idb-keyval',
],
resolve: {
alias: {
'/@/i18n': path.resolve(__dirname, './src/i18n'),
'/@/remote': path.resolve(__dirname, './src/remote'),
'/@/renderer': path.resolve(__dirname, './src/renderer'),
'/@/shared': path.resolve(__dirname, './src/shared'),
},
plugins: [
react(),
ViteEjsPlugin({
root: normalizePath(path.resolve(__dirname, './src/renderer')),
web: true,
}),
VitePWA({
devOptions: {
// The PWA will not be shown during development
enabled: false,
},
filename: 'sw.js',
injectRegister: 'inline',
manifest: {
background_color: '#FFDCB5',
display: 'standalone',
icons: [
{
sizes: '32x32',
src: '32x32.png',
type: 'image/png',
},
{
sizes: '64x64',
src: '64x64.png',
type: 'image/png',
},
{
sizes: '128x128',
src: '128x128.png',
type: 'image/png',
},
{
sizes: '256x256',
src: '256x256.png',
type: 'image/png',
},
{
purpose: 'any',
sizes: '512x512',
src: '512x512.png',
type: 'image/png',
},
{
sizes: '1024x1024',
src: '1024x1024.png',
type: 'image/png',
},
],
name: 'Feishin',
orientation: 'portrait',
screenshots: [
{
form_factor: 'wide',
label: 'Full screen player showing music player and lyrics',
sizes: '720x450',
src: 'preview_full_screen_player.webp',
type: 'image/webp',
},
],
short_name: 'Feishin',
start_url: '/',
theme_color: '#1E003D',
},
manifestFilename: 'assets/manifest.webmanifest',
outDir: path.resolve(__dirname, './out/web/'),
registerType: 'autoUpdate',
scope: '/',
workbox: {
cleanupOutdatedCaches: true,
clientsClaim: true,
maximumFileSizeToCacheInBytes: 1000000 * 5, // 5 MB
skipWaiting: true,
},
}),
],
resolve: {
alias: {
'/@/i18n': path.resolve(__dirname, './src/i18n'),
'/@/remote': path.resolve(__dirname, './src/remote'),
'/@/renderer': path.resolve(__dirname, './src/renderer'),
'/@/shared': path.resolve(__dirname, './src/shared'),
},
root: path.resolve(__dirname, './src/renderer'),
};
},
root: path.resolve(__dirname, './src/renderer'),
});