refactor timi-web
This commit is contained in:
+34
-1
@@ -8,11 +8,18 @@ import { TDesignResolver } from "unplugin-vue-components/resolvers";
|
||||
const localTimiWebRoot = fileURLToPath(new URL("../timi-web", import.meta.url));
|
||||
const localTimiWebModule = fileURLToPath(new URL("../timi-web/dist/timi-web.mjs", import.meta.url));
|
||||
const localTimiWebStyle = fileURLToPath(new URL("../timi-web/dist/timi-web.css", import.meta.url));
|
||||
const localTimiWebEditor = fileURLToPath(new URL("../timi-web/src/editor/index.ts", import.meta.url));
|
||||
const localTimiWebApiRoot = fileURLToPath(new URL("../timi-web-api", import.meta.url));
|
||||
const localTimiWebApiModule = fileURLToPath(new URL("../timi-web-api/dist/index.js", import.meta.url));
|
||||
const localTimiTDesignMobileRoot = fileURLToPath(new URL("../timi-tdesign-mobile", import.meta.url));
|
||||
const localTimiTDesignMobileModule = fileURLToPath(new URL("../timi-tdesign-mobile/src/index.ts", import.meta.url));
|
||||
const localTimiTDesignMobileStyle = fileURLToPath(new URL("../timi-tdesign-mobile/dist/timi-tdesign-mobile.css", import.meta.url));
|
||||
const projectRoot = fileURLToPath(new URL(".", import.meta.url));
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), "");
|
||||
const useLocalTimiWeb = env.VITE_USE_LOCAL_TIMI_WEB !== "false";
|
||||
const useLocalTimiTDesignMobile = env.VITE_USE_LOCAL_TIMI_TDESIGN_MOBILE !== "false";
|
||||
return {
|
||||
resolve: {
|
||||
dedupe: ["vue", "pinia", "vue-router"],
|
||||
@@ -27,11 +34,35 @@ export default defineConfig(({ mode }) => {
|
||||
find: /^timi-web$/,
|
||||
replacement: localTimiWebModule
|
||||
},
|
||||
{
|
||||
find: /^timi-web\/editor$/,
|
||||
replacement: localTimiWebEditor
|
||||
},
|
||||
{
|
||||
find: /^timi-web\/style\.css$/,
|
||||
replacement: localTimiWebStyle
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
find: /^timi-web-api$/,
|
||||
replacement: localTimiWebApiModule
|
||||
},
|
||||
{
|
||||
find: /^timi-web-api\//,
|
||||
replacement: `${localTimiWebApiRoot}/dist/`
|
||||
},
|
||||
...(useLocalTimiTDesignMobile
|
||||
? [
|
||||
{
|
||||
find: /^timi-tdesign-mobile$/,
|
||||
replacement: localTimiTDesignMobileModule
|
||||
},
|
||||
{
|
||||
find: /^timi-tdesign-mobile\/style\.css$/,
|
||||
replacement: localTimiTDesignMobileStyle
|
||||
}
|
||||
]
|
||||
: [])
|
||||
]
|
||||
},
|
||||
@@ -76,7 +107,9 @@ export default defineConfig(({ mode }) => {
|
||||
fs: {
|
||||
allow: [
|
||||
projectRoot,
|
||||
localTimiWebRoot
|
||||
localTimiWebRoot,
|
||||
localTimiWebApiRoot,
|
||||
localTimiTDesignMobileRoot
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user