mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
add hosted for online demo
This commit is contained in:
@@ -5,33 +5,39 @@ import svgrPlugin from 'vite-plugin-svgr';
|
||||
import { visualizer } from 'rollup-plugin-visualizer';
|
||||
import ProgmemGenerator from './progmem-generator';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
react({ plugins: [['@swc/plugin-styled-components', {}]] }),
|
||||
viteTsconfigPaths(),
|
||||
svgrPlugin(),
|
||||
ProgmemGenerator({ outputPath: '../lib/framework/WWWData.h', bytesPerLine: 20 }),
|
||||
visualizer({ gzipSize: true }) as PluginOption
|
||||
],
|
||||
// root: 'src',
|
||||
base: '/',
|
||||
// publicDir: "./public",
|
||||
build: {
|
||||
// Relative to the root
|
||||
outDir: 'build',
|
||||
chunkSizeWarningLimit: 1024
|
||||
},
|
||||
server: {
|
||||
open: true,
|
||||
port: 3000,
|
||||
proxy: {
|
||||
'/rest': 'http://localhost:3080',
|
||||
'/api': {
|
||||
target: 'http://localhost:3080',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
ws: true
|
||||
export default defineConfig(({ command, mode }) => {
|
||||
if (mode === 'hosted') {
|
||||
return {
|
||||
// hosted, ignore all errors, output to dist
|
||||
plugins: [react({ plugins: [['@swc/plugin-styled-components', {}]] }), viteTsconfigPaths(), svgrPlugin()]
|
||||
};
|
||||
} else {
|
||||
// normal build
|
||||
return {
|
||||
plugins: [
|
||||
react({ plugins: [['@swc/plugin-styled-components', {}]] }),
|
||||
viteTsconfigPaths(),
|
||||
svgrPlugin(),
|
||||
ProgmemGenerator({ outputPath: '../lib/framework/WWWData.h', bytesPerLine: 20 }),
|
||||
visualizer({ gzipSize: true }) as PluginOption
|
||||
],
|
||||
build: {
|
||||
outDir: 'build',
|
||||
chunkSizeWarningLimit: 1024
|
||||
},
|
||||
server: {
|
||||
open: true,
|
||||
port: 3000,
|
||||
proxy: {
|
||||
'/rest': 'http://localhost:3080',
|
||||
'/api': {
|
||||
target: 'http://localhost:3080',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
ws: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user