| ÎļþÃû´Ó src/internal/vite-config/src/config/application.ts ÐÞ¸Ä |
| | |
| | | |
| | | import type { DefineApplicationOptions } from '../typing'; |
| | | |
| | | import path from 'node:path'; |
| | | import path, { relative } from 'node:path'; |
| | | |
| | | import { findMonorepoRoot } from '@vben/node-utils'; |
| | | |
| | | import { NodePackageImporter } from 'sass-embedded'; |
| | | import { defineConfig, loadEnv, mergeConfig } from 'vite'; |
| | |
| | | } |
| | | |
| | | function createCssOptions(injectGlobalScss = true): CSSOptions { |
| | | const root = findMonorepoRoot(); |
| | | return { |
| | | preprocessorOptions: injectGlobalScss |
| | | ? { |
| | | scss: { |
| | | additionalData: (content: string) => { |
| | | return `@use "./src/packages/styles/src/global" as *;\n${content}`; |
| | | additionalData: (content: string, filepath: string) => { |
| | | const relativePath = relative(root, filepath); |
| | | // appsä¸çå
注å
¥å
¨å±æ ·å¼ |
| | | if (relativePath.startsWith(`apps${path.sep}`)) { |
| | | return `@use "@vben/styles/global" as *;\n${content}`; |
| | | } |
| | | return content; |
| | | }, |
| | | // api: 'modern', |
| | | importers: [new NodePackageImporter()], |
| | | }, |
| | | } |