Merge pull request #1302 from frappe/mergify/bp/main-hotfix/pr-1301
This commit is contained in:
commit
d1db5cf287
@ -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:',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user