revert: "fix: sass-embedded@1.98.0 在 macOS 13 会直接崩 (#7692)"
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
import type { CSSOptions, UserConfig } from "vite";
|
||||
import type { CSSOptions, UserConfig } from 'vite';
|
||||
|
||||
import type { DefineApplicationOptions } from "../typing";
|
||||
import type { DefineApplicationOptions } from '../typing';
|
||||
|
||||
import path, { relative } from "node:path";
|
||||
import path, { relative } from 'node:path';
|
||||
|
||||
import { findMonorepoRoot } from "@vben/node-utils";
|
||||
import { findMonorepoRoot } from '@vben/node-utils';
|
||||
|
||||
import { NodePackageImporter } from "sass";
|
||||
import { defineConfig, loadEnv, mergeConfig } from "vite";
|
||||
import { NodePackageImporter } from 'sass-embedded';
|
||||
import { defineConfig, loadEnv, mergeConfig } from 'vite';
|
||||
|
||||
import { defaultImportmapOptions, getDefaultPwaOptions } from "../options";
|
||||
import { loadApplicationPlugins } from "../plugins";
|
||||
import { loadAndConvertEnv } from "../utils/env";
|
||||
import { getCommonConfig } from "./common";
|
||||
import { defaultImportmapOptions, getDefaultPwaOptions } from '../options';
|
||||
import { loadApplicationPlugins } from '../plugins';
|
||||
import { loadAndConvertEnv } from '../utils/env';
|
||||
import { getCommonConfig } from './common';
|
||||
|
||||
function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
|
||||
return defineConfig(async (config) => {
|
||||
@@ -21,14 +21,14 @@ function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
|
||||
const { command, mode } = config;
|
||||
const { application = {}, vite = {} } = options || {};
|
||||
const root = process.cwd();
|
||||
const isBuild = command === "build";
|
||||
const isBuild = command === 'build';
|
||||
const env = loadEnv(mode, root);
|
||||
|
||||
const plugins = await loadApplicationPlugins({
|
||||
archiver: true,
|
||||
archiverPluginOptions: {},
|
||||
compress: false,
|
||||
compressTypes: ["brotli", "gzip"],
|
||||
compressTypes: ['brotli', 'gzip'],
|
||||
devtools: true,
|
||||
env,
|
||||
extraAppConfig: true,
|
||||
@@ -44,7 +44,7 @@ function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
|
||||
nitroMockOptions: {},
|
||||
print: !isBuild,
|
||||
printInfoMap: {
|
||||
"Vben Admin Docs": "https://doc.vben.pro",
|
||||
'Vben Admin Docs': 'https://doc.vben.pro',
|
||||
},
|
||||
pwa: true,
|
||||
pwaOptions: getDefaultPwaOptions(appTitle),
|
||||
@@ -60,9 +60,9 @@ function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
|
||||
build: {
|
||||
rolldownOptions: {
|
||||
output: {
|
||||
assetFileNames: "[ext]/[name]-[hash].[ext]",
|
||||
chunkFileNames: "js/[name]-[hash].js",
|
||||
entryFileNames: "jse/index-[name]-[hash].js",
|
||||
assetFileNames: '[ext]/[name]-[hash].[ext]',
|
||||
chunkFileNames: 'js/[name]-[hash].js',
|
||||
entryFileNames: 'jse/index-[name]-[hash].js',
|
||||
minify: isBuild
|
||||
? {
|
||||
compress: {
|
||||
@@ -72,7 +72,7 @@ function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
|
||||
: false,
|
||||
},
|
||||
},
|
||||
target: "es2015",
|
||||
target: 'es2015',
|
||||
},
|
||||
css: createCssOptions(injectGlobalScss),
|
||||
plugins,
|
||||
@@ -82,15 +82,18 @@ function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
|
||||
warmup: {
|
||||
// 预热文件
|
||||
clientFiles: [
|
||||
"./index.html",
|
||||
"./src/bootstrap.ts",
|
||||
"./src/{views,layouts,router,store,api,adapter}/*",
|
||||
'./index.html',
|
||||
'./src/bootstrap.ts',
|
||||
'./src/{views,layouts,router,store,api,adapter}/*',
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const mergedCommonConfig = mergeConfig(await getCommonConfig(), applicationConfig);
|
||||
const mergedCommonConfig = mergeConfig(
|
||||
await getCommonConfig(),
|
||||
applicationConfig,
|
||||
);
|
||||
return mergeConfig(mergedCommonConfig, vite);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user