kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Do some more dumb shit
rodzic
1ebe3ce48e
commit
f1dd87ba21
|
@ -9,6 +9,7 @@
|
|||
/.vs/
|
||||
yarn-error.log*
|
||||
/junit.xml
|
||||
*.timestamp-*
|
||||
|
||||
/static/
|
||||
/static-test/
|
||||
|
|
|
@ -1,12 +1,23 @@
|
|||
import path from 'path';
|
||||
|
||||
import react from '@vitejs/plugin-react';
|
||||
import { defineConfig } from 'vite';
|
||||
import { defineConfig, type Plugin } from 'vite';
|
||||
import compileTime from 'vite-plugin-compile-time';
|
||||
import { createHtmlPlugin } from 'vite-plugin-html';
|
||||
import vitePluginRequire from 'vite-plugin-require';
|
||||
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
||||
|
||||
const removeExportsPlugin: Plugin = {
|
||||
name: 'remove-sw-exports',
|
||||
generateBundle(_options, bundle) {
|
||||
for (const [name, chunk] of Object.entries(bundle)) {
|
||||
if (chunk.type === 'chunk' && name === 'sw.js') {
|
||||
chunk.code = chunk.code.replace(/export{.*};\s*$/g, '');
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default defineConfig({
|
||||
root: 'app',
|
||||
build: {
|
||||
|
@ -27,8 +38,11 @@ export default defineConfig({
|
|||
return 'packs/[name]-[hash].js';
|
||||
}
|
||||
},
|
||||
manualChunks: {
|
||||
'sw': ['app/soapbox/service-worker/sw.ts'],
|
||||
manualChunks: (id) => {
|
||||
if (id.includes('soapbox/service-worker')) {
|
||||
return 'sw';
|
||||
}
|
||||
return 'main';
|
||||
},
|
||||
assetFileNames: 'packs/assets/[name]-[hash].[ext]',
|
||||
chunkFileNames: 'packs/js/[name]-[hash].js',
|
||||
|
@ -58,6 +72,7 @@ export default defineConfig({
|
|||
dest: 'packs/emoji/',
|
||||
}],
|
||||
}),
|
||||
removeExportsPlugin,
|
||||
],
|
||||
resolve: {
|
||||
alias: [
|
||||
|
|
Ładowanie…
Reference in New Issue