mirror of
https://github.com/langgenius/dify.git
synced 2026-04-05 02:02:40 +08:00
tweaks
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { IS_DEV } from '@/config'
|
||||
import { env } from '@/env'
|
||||
import 'uno.css'
|
||||
|
||||
async function main() {
|
||||
// Polyfill for Array.prototype.toSpliced (ES2023, Chrome 110+)
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import UnoCSS from '@unocss/postcss'
|
||||
import autoprefixer from 'autoprefixer'
|
||||
|
||||
export default {
|
||||
plugins: [
|
||||
UnoCSS(),
|
||||
autoprefixer(),
|
||||
],
|
||||
}
|
||||
@@ -104,16 +104,19 @@ export default defineConfig({
|
||||
['bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]', { 'background-color': 'var(--shiki-dark-bg,var(--sdm-bg,inherit))' }],
|
||||
],
|
||||
content: {
|
||||
filesystem: [
|
||||
'./app/**/*.{js,ts,jsx,tsx,mdx,css}',
|
||||
'./context/**/*.{js,ts,jsx,tsx,css}',
|
||||
'./node_modules/streamdown/dist/*.js',
|
||||
'./node_modules/@streamdown/math/dist/*.js',
|
||||
'!./app/**/__tests__/**',
|
||||
'!./context/**/__tests__/**',
|
||||
'!./app/**/*.{spec,test}.{js,ts,jsx,tsx}',
|
||||
'!./context/**/*.{spec,test}.{js,ts,jsx,tsx}',
|
||||
],
|
||||
pipeline: {
|
||||
include: [
|
||||
/\.(vue|svelte|[jt]sx|vine.ts|mdx?|astro|elm|php|phtml|marko|html)($|\?)/,
|
||||
/\/app\/.*\.[jt]s($|\?)/,
|
||||
/\/context\/.*\.[jt]s($|\?)/,
|
||||
/\/node_modules\/streamdown\/dist\/.*\.js($|\?)/,
|
||||
/\/node_modules\/@streamdown\/math\/dist\/.*\.js($|\?)/,
|
||||
],
|
||||
exclude: [
|
||||
/\/__tests__\//,
|
||||
/\.(spec|test)\.[jt]sx?($|\?)/,
|
||||
],
|
||||
},
|
||||
},
|
||||
presets: [
|
||||
presetWind3(),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import autoprefixer from 'autoprefixer'
|
||||
import UnoCSS from 'unocss/vite'
|
||||
import vinext from 'vinext'
|
||||
import Inspect from 'vite-plugin-inspect'
|
||||
@@ -13,36 +12,6 @@ import { nextStaticImageTestPlugin } from './plugins/vite/next-static-image-test
|
||||
const projectRoot = fileURLToPath(new URL('.', import.meta.url))
|
||||
const isCI = !!process.env.CI
|
||||
const rootClientInjectTarget = getRootClientInjectTarget(projectRoot)
|
||||
const unoCssEntryTarget = `${projectRoot}app/layout.tsx`
|
||||
const unoGlobalsCssTarget = `${projectRoot}app/styles/globals.css`
|
||||
|
||||
const injectUnoCssPlugin = {
|
||||
name: 'inject-uno-css-entry',
|
||||
enforce: 'pre' as const,
|
||||
transform(code: string, id: string) {
|
||||
if (id !== unoCssEntryTarget || code.includes('virtual:uno.css'))
|
||||
return
|
||||
|
||||
return {
|
||||
code: `import 'virtual:uno.css'\n${code}`,
|
||||
map: null,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
const stripUnoPreflightDirectivePlugin = {
|
||||
name: 'strip-uno-preflight-directive',
|
||||
enforce: 'pre' as const,
|
||||
transform(code: string, id: string) {
|
||||
if (id !== unoGlobalsCssTarget || !code.includes('@unocss !preflights;'))
|
||||
return
|
||||
|
||||
return {
|
||||
code: code.replace('@unocss !preflights;', ''),
|
||||
map: null,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const isTest = mode === 'test'
|
||||
@@ -81,8 +50,6 @@ export default defineConfig(({ mode }) => {
|
||||
injectTarget: rootClientInjectTarget,
|
||||
projectRoot,
|
||||
}),
|
||||
injectUnoCssPlugin,
|
||||
stripUnoPreflightDirectivePlugin,
|
||||
UnoCSS(),
|
||||
react(),
|
||||
vinext({ react: false }),
|
||||
@@ -95,13 +62,6 @@ export default defineConfig(({ mode }) => {
|
||||
resolve: {
|
||||
tsconfigPaths: true,
|
||||
},
|
||||
css: {
|
||||
postcss: {
|
||||
plugins: [
|
||||
autoprefixer(),
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
// vinext related config
|
||||
...(!isTest && !isStorybook
|
||||
|
||||
Reference in New Issue
Block a user