Merge pull request #1302 from frappe/mergify/bp/main-hotfix/pr-1301

This commit is contained in:
Shariq Ansari 2025-10-01 00:13:10 -07:00 committed by GitHub
commit d1db5cf287
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 5 deletions

View File

@ -2,7 +2,6 @@ import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx' import vueJsx from '@vitejs/plugin-vue-jsx'
import path from 'path' import path from 'path'
import frappeui from 'frappe-ui/vite'
import { VitePWA } from 'vite-plugin-pwa' import { VitePWA } from 'vite-plugin-pwa'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
@ -89,10 +88,12 @@ export default defineConfig(async ({ mode }) => {
// Check if the local frappe-ui directory exists // Check if the local frappe-ui directory exists
const fs = await import('node:fs') const fs = await import('node:fs')
const localFrappeUIPath = path.resolve(__dirname, '../frappe-ui') const localFrappeUIPath = path.resolve(__dirname, '../frappe-ui')
if (fs.existsSync(localFrappeUIPath)) { const vitePluginPath = path.resolve(localFrappeUIPath, 'vite.js')
if (fs.existsSync(localFrappeUIPath) && fs.existsSync(vitePluginPath)) {
config.resolve.alias['frappe-ui'] = localFrappeUIPath config.resolve.alias['frappe-ui'] = localFrappeUIPath
} else { } else {
console.warn('Local frappe-ui directory not found, using npm package') console.warn('Local frappe-ui directory not found or incomplete, using npm package')
} }
} catch (error) { } catch (error) {
console.warn( console.warn(
@ -108,8 +109,16 @@ export default defineConfig(async ({ mode }) => {
async function importFrappeUIPlugin(isDev) { async function importFrappeUIPlugin(isDev) {
if (isDev) { if (isDev) {
try { try {
const module = await import('../frappe-ui/vite') // Check if local frappe-ui has the vite plugin file
return module.default const fs = await import('node:fs')
const localVitePluginPath = path.resolve(__dirname, '../frappe-ui/vite.js')
if (fs.existsSync(localVitePluginPath)) {
const module = await import('../frappe-ui/vite')
return module.default
} else {
console.warn('Local frappe-ui vite plugin not found, using npm package')
}
} catch (error) { } catch (error) {
console.warn( console.warn(
'Local frappe-ui not found, falling back to npm package:', 'Local frappe-ui not found, falling back to npm package:',

4
yarn.lock Normal file
View File

@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1