Fix web production build pipeline
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
22.1.0
|
||||
22.16.0
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
VITE_APP_TITLE=AI Agent Admin
|
||||
VITE_BASE=/ai-agent-admin/
|
||||
VITE_GLOB_API_URL=/ai-agent-admin/basic-api
|
||||
VITE_COMPRESS=none
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
import { build } from 'vite';
|
||||
|
||||
function tracePlugin() {
|
||||
const importers = [];
|
||||
return {
|
||||
name: 'trace-jiti-importer',
|
||||
async resolveId(source, importer, options) {
|
||||
if (source.includes('jiti') || importer?.includes('jiti')) {
|
||||
console.log('[resolve]', JSON.stringify({ source, importer }));
|
||||
}
|
||||
const resolved = await this.resolve(source, importer, {
|
||||
...options,
|
||||
skipSelf: true,
|
||||
});
|
||||
if (resolved?.id?.includes('jiti') || source.includes('jiti')) {
|
||||
console.log(
|
||||
'[resolved]',
|
||||
JSON.stringify({ source, importer, resolved: resolved?.id }),
|
||||
);
|
||||
}
|
||||
return resolved;
|
||||
},
|
||||
moduleParsed(info) {
|
||||
if (info.importedIds.some((id) => id.includes('jiti'))) {
|
||||
importers.push({
|
||||
id: info.id,
|
||||
importedIds: info.importedIds.filter((id) => id.includes('jiti')),
|
||||
});
|
||||
console.log('[imports-jiti]', JSON.stringify(importers.at(-1)));
|
||||
}
|
||||
if (info.id.includes('jiti')) {
|
||||
console.log('[module-jiti]', info.id);
|
||||
console.log('[jiti-importers]', JSON.stringify(importers, null, 2));
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
await build({
|
||||
configFile: './vite.config.mts',
|
||||
mode: 'production',
|
||||
plugins: [tracePlugin()],
|
||||
build: {
|
||||
write: false,
|
||||
},
|
||||
});
|
||||
@@ -7,6 +7,11 @@ import ElementPlus from 'unplugin-element-plus/vite';
|
||||
const resolveLocal = (path: string) =>
|
||||
fileURLToPath(new URL(path, import.meta.url));
|
||||
|
||||
const exactAlias = (find: string, path: string) => ({
|
||||
find: new RegExp(`^${find.replaceAll('/', '\\/')}$`),
|
||||
replacement: resolveLocal(path),
|
||||
});
|
||||
|
||||
export default defineConfig(async () => {
|
||||
return {
|
||||
application: {
|
||||
@@ -15,32 +20,142 @@ export default defineConfig(async () => {
|
||||
},
|
||||
vite: {
|
||||
resolve: {
|
||||
alias: {
|
||||
'#/components/form-editor': resolveLocal(
|
||||
alias: [
|
||||
exactAlias(
|
||||
'#/components/form-editor',
|
||||
'./src/components/ai-chat-panel/form-editor-lite.ts',
|
||||
),
|
||||
'@vben-core/shared/cache': resolveLocal(
|
||||
exactAlias(
|
||||
'@vben-core/design',
|
||||
'../../packages/@core/base/design/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben-core/design/bem',
|
||||
'../../packages/@core/base/design/src/scss-bem/bem.scss',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben-core/composables',
|
||||
'../../packages/@core/composables/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben-core/form-ui',
|
||||
'../../packages/@core/ui-kit/form-ui/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben-core/icons',
|
||||
'../../packages/@core/base/icons/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben-core/layout-ui',
|
||||
'../../packages/@core/ui-kit/layout-ui/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben-core/menu-ui',
|
||||
'../../packages/@core/ui-kit/menu-ui/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben-core/popup-ui',
|
||||
'../../packages/@core/ui-kit/popup-ui/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben-core/preferences',
|
||||
'../../packages/@core/preferences/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben-core/shadcn-ui',
|
||||
'../../packages/@core/ui-kit/shadcn-ui/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben-core/shared/cache',
|
||||
'../../packages/@core/base/shared/src/cache/index.ts',
|
||||
),
|
||||
'@vben-core/shared/color': resolveLocal(
|
||||
exactAlias(
|
||||
'@vben-core/shared/color',
|
||||
'../../packages/@core/base/shared/src/color/index.ts',
|
||||
),
|
||||
'@vben-core/shared/constants': resolveLocal(
|
||||
exactAlias(
|
||||
'@vben-core/shared/constants',
|
||||
'../../packages/@core/base/shared/src/constants/index.ts',
|
||||
),
|
||||
'@vben-core/shared/global-state': resolveLocal(
|
||||
exactAlias(
|
||||
'@vben-core/shared/global-state',
|
||||
'../../packages/@core/base/shared/src/global-state.ts',
|
||||
),
|
||||
'@vben-core/shared/store': resolveLocal(
|
||||
exactAlias(
|
||||
'@vben-core/shared/store',
|
||||
'../../packages/@core/base/shared/src/store.ts',
|
||||
),
|
||||
'@vben-core/shared/utils': resolveLocal(
|
||||
exactAlias(
|
||||
'@vben-core/shared/utils',
|
||||
'../../packages/@core/base/shared/src/utils/index.ts',
|
||||
),
|
||||
'pinia-plugin-persistedstate': resolveLocal(
|
||||
'../../node_modules/pinia-plugin-persistedstate/dist/index.js',
|
||||
exactAlias(
|
||||
'@vben-core/tabs-ui',
|
||||
'../../packages/@core/ui-kit/tabs-ui/src/index.ts',
|
||||
),
|
||||
},
|
||||
exactAlias(
|
||||
'@vben-core/typings',
|
||||
'../../packages/@core/base/typings/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben/access',
|
||||
'../../packages/effects/access/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben/common-ui',
|
||||
'../../packages/effects/common-ui/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben/common-ui/es/tippy',
|
||||
'../../packages/effects/common-ui/src/components/tippy/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben/constants',
|
||||
'../../packages/constants/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben/hooks',
|
||||
'../../packages/effects/hooks/src/index.ts',
|
||||
),
|
||||
exactAlias('@vben/icons', '../../packages/icons/src/index.ts'),
|
||||
exactAlias(
|
||||
'@vben/layouts',
|
||||
'../../packages/effects/layouts/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben/layouts/preferences-blocks',
|
||||
'../../packages/effects/layouts/src/widgets/preferences/blocks/index.ts',
|
||||
),
|
||||
exactAlias('@vben/locales', '../../packages/locales/src/index.ts'),
|
||||
exactAlias(
|
||||
'@vben/plugins/echarts',
|
||||
'../../packages/effects/plugins/src/echarts/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben/plugins/motion',
|
||||
'../../packages/effects/plugins/src/motion/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben/plugins/vxe-table',
|
||||
'../../packages/effects/plugins/src/vxe-table/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben/preferences',
|
||||
'../../packages/preferences/src/index.ts',
|
||||
),
|
||||
exactAlias(
|
||||
'@vben/request',
|
||||
'../../packages/effects/request/src/index.ts',
|
||||
),
|
||||
exactAlias('@vben/stores', '../../packages/stores/src/index.ts'),
|
||||
exactAlias('@vben/styles', '../../packages/styles/src/index.ts'),
|
||||
exactAlias(
|
||||
'@vben/styles/ele',
|
||||
'../../packages/styles/src/ele/index.css',
|
||||
),
|
||||
exactAlias('@vben/types', '../../packages/types/src/index.ts'),
|
||||
exactAlias('@vben/utils', '../../packages/utils/src/index.ts'),
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
ElementPlus({
|
||||
|
||||
@@ -4,4 +4,7 @@ export default defineBuildConfig({
|
||||
clean: true,
|
||||
declaration: true,
|
||||
entries: ['src/index'],
|
||||
stubOptions: {
|
||||
absoluteJitiPath: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -4,4 +4,7 @@ export default defineBuildConfig({
|
||||
clean: true,
|
||||
declaration: true,
|
||||
entries: ['src/index'],
|
||||
stubOptions: {
|
||||
absoluteJitiPath: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -193,7 +193,14 @@ async function loadApplicationPlugins(
|
||||
},
|
||||
{
|
||||
condition: !!html,
|
||||
plugins: () => [viteHtmlPlugin({ minify: true })],
|
||||
plugins: () => [
|
||||
viteHtmlPlugin({
|
||||
inject: {
|
||||
data: env,
|
||||
},
|
||||
minify: true,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
condition: isBuild && importmap,
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@
|
||||
"vue-tsc": "catalog:"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.10.0",
|
||||
"node": ">=20.19.0 || >=22.12.0",
|
||||
"pnpm": ">=9.12.0"
|
||||
},
|
||||
"packageManager": "pnpm@10.14.0",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export * from './about';
|
||||
export * from './authentication';
|
||||
export * from './dashboard';
|
||||
export * from './fallback';
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
import { build } from 'vite';
|
||||
|
||||
const seen = new Map();
|
||||
|
||||
function tracePlugin() {
|
||||
return {
|
||||
name: 'trace-jiti-importer',
|
||||
async resolveId(source, importer, options) {
|
||||
if (source.includes('jiti') || importer?.includes('jiti')) {
|
||||
console.log('[resolve]', { source, importer });
|
||||
}
|
||||
const resolved = await this.resolve(source, importer, {
|
||||
...options,
|
||||
skipSelf: true,
|
||||
});
|
||||
if (resolved?.id?.includes('jiti') || source.includes('jiti')) {
|
||||
console.log('[resolved]', { source, importer, resolved: resolved?.id });
|
||||
}
|
||||
return resolved;
|
||||
},
|
||||
load(id) {
|
||||
if (id.includes('jiti')) {
|
||||
console.log('[load]', id);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
moduleParsed(info) {
|
||||
if (info.id.includes('jiti')) {
|
||||
console.log('[moduleParsed]', info.id);
|
||||
console.log(
|
||||
'[importers]',
|
||||
Array.from(seen.entries()).filter(([, imports]) =>
|
||||
imports.some((item) => item.includes('jiti')),
|
||||
),
|
||||
);
|
||||
}
|
||||
seen.set(info.id, Array.from(info.importedIds));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
await build({
|
||||
configFile: './apps/web-ele/vite.config.mts',
|
||||
mode: 'production',
|
||||
plugins: [tracePlugin()],
|
||||
build: {
|
||||
write: false,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user