This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-theme-builder.git
The following commit(s) were added to refs/heads/master by this push:
new 2a21e68 fix assets base dir & update scripts
2a21e68 is described below
commit 2a21e68c76bb2fdf353bc6d2c2eee073fb7784bc
Author: plainheart <[email protected]>
AuthorDate: Sat Nov 8 09:00:15 2025 +0800
fix assets base dir & update scripts
---
.vscode/settings.json | 5 +++++
package.json | 4 ++--
src/stores/theme.ts | 2 +-
vite.config.ts | 12 ++++++++----
4 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..4e71344
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,5 @@
+{
+ "i18n-ally.localesPaths": [
+ "src/locales"
+ ]
+}
\ No newline at end of file
diff --git a/package.json b/package.json
index dbec681..8af3dce 100644
--- a/package.json
+++ b/package.json
@@ -5,10 +5,10 @@
"type": "module",
"scripts": {
"dev": "vite",
- "build": "vue-tsc -b && vite build",
+ "build": "vue-tsc -b && vite build && vite build --mode app",
"serve:dist": "http-server dist",
"serve:app": "http-server app",
- "release": "npm run build -- --mode app && node scripts/release.js"
+ "release": "vue-tsc -b && vite build --mode app && node scripts/release.js"
},
"dependencies": {
"vant": "^4.9.21",
diff --git a/src/stores/theme.ts b/src/stores/theme.ts
index 4c0b937..05134dd 100644
--- a/src/stores/theme.ts
+++ b/src/stores/theme.ts
@@ -254,7 +254,7 @@ const createThemeStore = () => {
try {
// Load the complete theme configuration from JSON file
- const response = await
fetch(`${import.meta.env.BASE_URL}themes/${preTheme.name}.json`, {
+ const response = await
fetch(`${import.meta.env.VITE_APP_ASSETS_DIR}themes/${preTheme.name}.json`, {
signal: definedThemeLoadAbortController.signal
})
if (!response.ok) {
diff --git a/vite.config.ts b/vite.config.ts
index 934877e..334c2cc 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -5,6 +5,8 @@ import { viteStaticCopy } from 'vite-plugin-static-copy'
export default defineConfig((env) => {
const isBuildForApp = env.mode === 'app'
+ const publicDir = 'public'
+ const assetsDir = isBuildForApp ? './theme-builder/' : './'
return {
plugins: [
vue({
@@ -18,8 +20,8 @@ export default defineConfig((env) => {
isBuildForApp && viteStaticCopy({
targets: [
{
- src: 'public/*',
- dest: './theme-builder'
+ src: publicDir + '/*',
+ dest: assetsDir
}
]
}),
@@ -40,10 +42,11 @@ export default defineConfig((env) => {
}
}
],
+ publicDir,
build: {
outDir: isBuildForApp ? 'app' : 'dist', // Target different output
directories based on the build mode
emptyOutDir: true,
- assetsDir: isBuildForApp ? './theme-builder' : '.',
+ assetsDir,
// public dir will be copied via vite-plugin-static-copy when building
for app
copyPublicDir: !isBuildForApp,
rollupOptions: {
@@ -66,7 +69,8 @@ export default defineConfig((env) => {
define: {
'import.meta.env.VITE_EXTERNAL_ECHARTS_SCRIPT': isBuildForApp
? `""`
- : `"<script
src=\\"https://echarts.apache.org/en/js/vendors/echarts/dist/echarts.min.js\\"></script>"`
+ : `"<script
src=\\"https://echarts.apache.org/en/js/vendors/echarts/dist/echarts.min.js\\"></script>"`,
+ 'import.meta.env.VITE_APP_ASSETS_DIR': JSON.stringify(assetsDir)
}
}
});
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]