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:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
# build
|
# build
|
||||||
build/
|
build/
|
||||||
|
dist/
|
||||||
.clang_complete
|
.clang_complete
|
||||||
.gcc-flags.json
|
.gcc-flags.json
|
||||||
cppcheck.out.xml
|
cppcheck.out.xml
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc && vite build",
|
"build": "tsc && vite build",
|
||||||
|
"build-hosted": "tsc && vite build --mode hosted",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"preview_standalone": "npm-run-all -p preview typesafe-i18n mock-api",
|
"preview-standalone": "npm-run-all -p preview typesafe-i18n mock-api",
|
||||||
"mock-api": "nodemon --watch ../mock-api ../mock-api/server.js",
|
"mock-api": "nodemon --watch ../mock-api ../mock-api/server.js",
|
||||||
"standalone": "npm-run-all -p dev typesafe-i18n mock-api",
|
"standalone": "npm-run-all -p dev typesafe-i18n mock-api",
|
||||||
"typesafe-i18n": "typesafe-i18n",
|
"typesafe-i18n": "typesafe-i18n",
|
||||||
|
|||||||
@@ -5,7 +5,15 @@ import svgrPlugin from 'vite-plugin-svgr';
|
|||||||
import { visualizer } from 'rollup-plugin-visualizer';
|
import { visualizer } from 'rollup-plugin-visualizer';
|
||||||
import ProgmemGenerator from './progmem-generator';
|
import ProgmemGenerator from './progmem-generator';
|
||||||
|
|
||||||
export default defineConfig({
|
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: [
|
plugins: [
|
||||||
react({ plugins: [['@swc/plugin-styled-components', {}]] }),
|
react({ plugins: [['@swc/plugin-styled-components', {}]] }),
|
||||||
viteTsconfigPaths(),
|
viteTsconfigPaths(),
|
||||||
@@ -13,11 +21,7 @@ export default defineConfig({
|
|||||||
ProgmemGenerator({ outputPath: '../lib/framework/WWWData.h', bytesPerLine: 20 }),
|
ProgmemGenerator({ outputPath: '../lib/framework/WWWData.h', bytesPerLine: 20 }),
|
||||||
visualizer({ gzipSize: true }) as PluginOption
|
visualizer({ gzipSize: true }) as PluginOption
|
||||||
],
|
],
|
||||||
// root: 'src',
|
|
||||||
base: '/',
|
|
||||||
// publicDir: "./public",
|
|
||||||
build: {
|
build: {
|
||||||
// Relative to the root
|
|
||||||
outDir: 'build',
|
outDir: 'build',
|
||||||
chunkSizeWarningLimit: 1024
|
chunkSizeWarningLimit: 1024
|
||||||
},
|
},
|
||||||
@@ -34,4 +38,6 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user