add hosted target

This commit is contained in:
Proddy
2023-11-19 21:17:36 +01:00
parent 905b52e39d
commit b300181d33

View File

@@ -5,7 +5,6 @@ import viteImagemin from 'vite-plugin-imagemin';
import { visualizer } from 'rollup-plugin-visualizer'; import { visualizer } from 'rollup-plugin-visualizer';
export default defineConfig(({ command, mode }) => { export default defineConfig(({ command, mode }) => {
// standalone build for development - runs the server
if (command === 'serve') { if (command === 'serve') {
console.log('Preparing for standalone build with server, mode=' + mode); console.log('Preparing for standalone build with server, mode=' + mode);
return { return {
@@ -30,9 +29,17 @@ export default defineConfig(({ command, mode }) => {
}; };
} }
if (command === 'build' && mode === 'hosted') {
return {
plugins: [preact(), viteTsconfigPaths()],
build: {
chunkSizeWarningLimit: 1024
}
};
}
// production build, both for hosted and building the firmware // production build, both for hosted and building the firmware
if (command === 'build') { if (command === 'build') {
console.log('Preparing for production build, mode is ' + mode);
return { return {
plugins: [ plugins: [
preact(), preact(),
@@ -79,11 +86,7 @@ export default defineConfig(({ command, mode }) => {
build: { build: {
// target: 'es2022', // target: 'es2022',
outDir: 'dist',
reportCompressedSize: false,
chunkSizeWarningLimit: 1024, chunkSizeWarningLimit: 1024,
sourcemap: false,
manifest: false,
minify: 'terser', minify: 'terser',
terserOptions: { terserOptions: {
compress: { compress: {
@@ -109,16 +112,6 @@ export default defineConfig(({ command, mode }) => {
nameCache: null, nameCache: null,
safari10: false, safari10: false,
toplevel: false toplevel: false
},
rollupOptions: {
// Ignore "use client" waning since we are not using SSR
onwarn(warning, warn) {
if (warning.code === 'MODULE_LEVEL_DIRECTIVE' && warning.message.includes(`"use client"`)) {
return;
}
warn(warning);
}
} }
} }
}; };