uppy/private/dev/vite.config.js
Mikael Finstad 0c16fe44b9
Golden retriever refactor and UppyFile type improvements (#5978)
Probably best reviewed commit by commit.

I also split UppyFile into two intefaces distinguished by the `isRemote`
boolean:
- LocalUppyFile
- RemoteUppyFile

Also:
- Removed the TagFile type
- Don't re-upload completed files - fixes #5930
- Clean up stored files on `complete` event *only* if *all* files
succeeded (no failed files). this allows the user to retry failed files
if the browser & upload get interrupted - fixes #5927, closes #5955
- Only set `isGhost` for non-successful files. it doesn't make sense for
successfully uploaded files to be ghosted because they're already done.
#5930

fixes #6013

---------

Co-authored-by: Prakash <qxprakash@gmail.com>
2025-10-17 23:17:40 +08:00

51 lines
1.1 KiB
JavaScript

import { fileURLToPath } from 'node:url'
const ROOT = new URL('../../', import.meta.url)
const PACKAGES_ROOT = fileURLToPath(new URL('./packages/', ROOT))
/**
* @type {import('vite').UserConfig}
*/
const config = {
envDir: fileURLToPath(ROOT),
esbuild: {
jsx: 'automatic',
jsxImportSource: 'preact',
},
build: {
rollupOptions: {
input: {
main: './index.html',
sw: './sw.js',
},
output: {
entryFileNames: (chunk) => {
if (chunk.name === 'sw') return 'sw.js' // force predictable filename
return 'assets/[name].[hash].js'
},
},
},
},
resolve: {
alias: [
{
find: /^uppy\/(.+)$/,
replacement: `${PACKAGES_ROOT}uppy/$1`,
},
{
find: /^@uppy\/([^/]+)$/,
replacement: `${PACKAGES_ROOT}@uppy/$1/src/index`,
},
{
find: /^@uppy\/([^/]+)\/lib\/(.+?)(\.js)?$/,
replacement: `${PACKAGES_ROOT}@uppy/$1/src/$2`,
},
// {
// find: /^@uppy\/([^/]+)\/(.+)$/,
// replacement: PACKAGES_ROOT + "@uppy/$1/src/$2",
// },
],
},
}
export default config