vite: simplify config

This commit is contained in:
Alex Gleason 2023-09-18 16:57:13 -05:00
parent dd97a46a03
commit c85c623d25
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -11,10 +11,7 @@ import vitePluginRequire from 'vite-plugin-require';
import { viteStaticCopy } from 'vite-plugin-static-copy'; import { viteStaticCopy } from 'vite-plugin-static-copy';
export default defineConfig({ export default defineConfig({
root: 'src',
build: { build: {
// Relative to the root
outDir: '../dist',
assetsDir: 'packs', assetsDir: 'packs',
assetsInlineLimit: 0, assetsInlineLimit: 0,
rollupOptions: { rollupOptions: {
@ -25,6 +22,7 @@ export default defineConfig({
}, },
}, },
}, },
assetsInclude: ['**/*.oga'],
server: { server: {
port: 3036, port: 3036,
}, },
@ -33,7 +31,7 @@ export default defineConfig({
vitePluginRequire.default(), vitePluginRequire.default(),
compileTime(), compileTime(),
createHtmlPlugin({ createHtmlPlugin({
template: 'index.html', template: 'src/index.html',
minify: { minify: {
collapseWhitespace: true, collapseWhitespace: true,
removeComments: false, removeComments: false,
@ -62,12 +60,12 @@ export default defineConfig({
short_name: 'Soapbox', short_name: 'Soapbox',
description: 'A social media frontend with a focus on custom branding and ease of use.', description: 'A social media frontend with a focus on custom branding and ease of use.',
}, },
srcDir: 'service-worker', srcDir: 'src/service-worker',
filename: 'sw.ts', filename: 'sw.ts',
}), }),
viteStaticCopy({ viteStaticCopy({
targets: [{ targets: [{
src: '../node_modules/twemoji/assets/svg/*', src: './node_modules/twemoji/assets/svg/*',
dest: 'packs/emoji/', dest: 'packs/emoji/',
}], }],
}), }),
@ -82,13 +80,9 @@ export default defineConfig({
{ find: 'soapbox', replacement: fileURLToPath(new URL('./src', import.meta.url)) }, { find: 'soapbox', replacement: fileURLToPath(new URL('./src', import.meta.url)) },
], ],
}, },
assetsInclude: ['**/*.oga'],
test: { test: {
globals: true, globals: true,
environment: 'jsdom', environment: 'jsdom',
cache: { setupFiles: 'src/jest/test-setup.ts',
dir: '../node_modules/.vitest',
},
setupFiles: 'jest/test-setup.ts',
}, },
}); });