mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
add hosted target
This commit is contained in:
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user