|
|
@ -2,7 +2,7 @@ import ora from 'ora'
|
|
|
|
import path from 'path'
|
|
|
|
import path from 'path'
|
|
|
|
import fs from 'fs-extra'
|
|
|
|
import fs from 'fs-extra'
|
|
|
|
import { build, BuildOptions, UserConfig as ViteUserConfig } from 'vite'
|
|
|
|
import { build, BuildOptions, UserConfig as ViteUserConfig } from 'vite'
|
|
|
|
import { RollupOutput } from 'rollup'
|
|
|
|
import { GetModuleInfo, RollupOutput } from 'rollup'
|
|
|
|
import { slash } from '../utils/slash'
|
|
|
|
import { slash } from '../utils/slash'
|
|
|
|
import { SiteConfig } from '../config'
|
|
|
|
import { SiteConfig } from '../config'
|
|
|
|
import { APP_PATH } from '../alias'
|
|
|
|
import { APP_PATH } from '../alias'
|
|
|
@ -90,7 +90,7 @@ export async function bundle(
|
|
|
|
return 'framework'
|
|
|
|
return 'framework'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (
|
|
|
|
if (
|
|
|
|
isEagerChunk(id, ctx) &&
|
|
|
|
isEagerChunk(id, ctx.getModuleInfo) &&
|
|
|
|
(/@vue\/(runtime|shared|reactivity)/.test(id) ||
|
|
|
|
(/@vue\/(runtime|shared|reactivity)/.test(id) ||
|
|
|
|
/vitepress\/dist\/client/.test(id))
|
|
|
|
/vitepress\/dist\/client/.test(id))
|
|
|
|
) {
|
|
|
|
) {
|
|
|
@ -154,7 +154,7 @@ const cache = new Map<string, boolean>()
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Check if a module is statically imported by at least one entry.
|
|
|
|
* Check if a module is statically imported by at least one entry.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function isEagerChunk(id: string, { getModuleInfo }: any) {
|
|
|
|
function isEagerChunk(id: string, getModuleInfo: GetModuleInfo) {
|
|
|
|
if (
|
|
|
|
if (
|
|
|
|
id.includes('node_modules') &&
|
|
|
|
id.includes('node_modules') &&
|
|
|
|
!/\.css($|\\?)/.test(id) &&
|
|
|
|
!/\.css($|\\?)/.test(id) &&
|
|
|
@ -166,7 +166,7 @@ function isEagerChunk(id: string, { getModuleInfo }: any) {
|
|
|
|
|
|
|
|
|
|
|
|
function staticImportedByEntry(
|
|
|
|
function staticImportedByEntry(
|
|
|
|
id: string,
|
|
|
|
id: string,
|
|
|
|
getModuleInfo: any,
|
|
|
|
getModuleInfo: GetModuleInfo,
|
|
|
|
cache: Map<string, boolean>,
|
|
|
|
cache: Map<string, boolean>,
|
|
|
|
importStack: string[] = []
|
|
|
|
importStack: string[] = []
|
|
|
|
): boolean {
|
|
|
|
): boolean {
|
|
|
|