Skip to content

chore: remove deprecated splitVendorChunkPlugin #19255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/vite/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ export type { TransformOptions as EsbuildTransformOptions } from 'esbuild'
export type { ESBuildOptions, ESBuildTransformResult } from './plugins/esbuild'
export type { Manifest, ManifestChunk } from './plugins/manifest'
export type { ResolveOptions, InternalResolveOptions } from './plugins/resolve'
export type { SplitVendorChunkCache } from './plugins/splitVendorChunk'
export type { TerserOptions } from './plugins/terser'

export type {
Expand Down
3 changes: 2 additions & 1 deletion packages/vite/src/node/optimizer/esbuildDepPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import {
escapeRegex,
flattenId,
isBuiltin,
isCSSRequest,
isExternalUrl,
moduleListContains,
normalizePath,
} from '../utils'
import { browserExternalId, optionalPeerDepId } from '../plugins/resolve'
import { isCSSRequest, isModuleCSSRequest } from '../plugins/css'
import { isModuleCSSRequest } from '../plugins/css'
import type { Environment } from '../environment'
import { createBackCompatIdResolver } from '../idResolver'

Expand Down
4 changes: 1 addition & 3 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import {
getPackageManagerCommand,
getPkgName,
injectQuery,
isCSSRequest,
isDataUrl,
isExternalUrl,
isObject,
Expand Down Expand Up @@ -256,9 +257,6 @@ type CssLang =
| keyof typeof PreprocessLang
| keyof typeof PostCssDialectLang

export const isCSSRequest = (request: string): boolean =>
CSS_LANGS_RE.test(request)

export const isModuleCSSRequest = (request: string): boolean =>
cssModuleRE.test(request)

Expand Down
3 changes: 1 addition & 2 deletions packages/vite/src/node/plugins/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { transform } from 'esbuild'
import { TraceMap, decodedMap, encodedMap } from '@jridgewell/trace-mapping'
import type { ResolvedConfig } from '../config'
import type { Plugin } from '../plugin'
import { escapeRegex } from '../utils'
import { escapeRegex, isCSSRequest } from '../utils'
import type { Environment } from '../environment'
import { isCSSRequest } from './css'
import { isHTMLRequest } from './html'

const nonJsRe = /\.json(?:$|\?)/
Expand Down
3 changes: 2 additions & 1 deletion packages/vite/src/node/plugins/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
encodeURIPath,
generateCodeFrame,
getHash,
isCSSRequest,
isDataUrl,
isExternalUrl,
normalizePath,
Expand All @@ -40,7 +41,7 @@ import {
publicAssetUrlRE,
urlToBuiltUrl,
} from './asset'
import { cssBundleNameCache, isCSSRequest } from './css'
import { cssBundleNameCache } from './css'
import { modulePreloadPolyfillId } from './modulePreloadPolyfill'

interface ScriptAssetsUrl {
Expand Down
3 changes: 2 additions & 1 deletion packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
getHash,
injectQuery,
isBuiltin,
isCSSRequest,
isDataUrl,
isDefined,
isExternalUrl,
Expand Down Expand Up @@ -67,7 +68,7 @@ import {
} from '../../shared/utils'
import type { TransformPluginContext } from '../server/pluginContainer'
import { throwOutdatedRequest } from './optimizedDeps'
import { isCSSRequest, isDirectCSSRequest } from './css'
import { isDirectCSSRequest } from './css'
import { browserExternalId } from './resolve'
import { serializeDefine } from './define'
import { WORKER_FILE_ID } from './worker'
Expand Down
154 changes: 0 additions & 154 deletions packages/vite/src/node/plugins/splitVendorChunk.ts

This file was deleted.

6 changes: 1 addition & 5 deletions packages/vite/src/node/publicUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@ export {
defaultAllowedOrigins,
} from './constants'
export { version as esbuildVersion } from 'esbuild'
export {
splitVendorChunkPlugin,
splitVendorChunk,
isCSSRequest,
} from './plugins/splitVendorChunk'
export {
normalizePath,
mergeConfig,
mergeAlias,
createFilter,
isCSSRequest,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to move isCSSRequest as we were duplicating it in splitVendorChunk to be able to export it in publicUtils. We could move in another PR other utils like isCSSModule to utils too.

rollupVersion,
} from './utils'
export { perEnvironmentPlugin } from './plugin'
Expand Down
3 changes: 1 addition & 2 deletions packages/vite/src/node/server/hmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import type {
InvokeSendData,
} from '../../shared/invokeMethods'
import { CLIENT_DIR } from '../constants'
import { createDebugger, normalizePath } from '../utils'
import { createDebugger, isCSSRequest, normalizePath } from '../utils'
import type { InferCustomEventPayload, ViteDevServer } from '..'
import { getHookHandler } from '../plugins'
import { isCSSRequest } from '../plugins/css'
import { isExplicitImportRequired } from '../plugins/importAnalysis'
import { getEnvFilesForMode } from '../env'
import type { Environment } from '../environment'
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/server/middlewares/indexHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
fsPathFromId,
getHash,
injectQuery,
isCSSRequest,
isDevServer,
isJSRequest,
joinUrlSegments,
Expand All @@ -40,7 +41,6 @@ import {
stripBase,
} from '../../utils'
import { checkPublicFile } from '../../publicDir'
import { isCSSRequest } from '../../plugins/css'
import { getCodeWithSourcemap, injectSourcesContent } from '../sourcemap'
import { cleanUrl, unwrapId, wrapId } from '../../../shared/utils'
import { getNodeAssetAttributes } from '../../assetSource'
Expand Down
7 changes: 2 additions & 5 deletions packages/vite/src/node/server/middlewares/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
createDebugger,
fsPathFromId,
injectQuery,
isCSSRequest,
isImportRequest,
isJSRequest,
normalizePath,
Expand All @@ -30,11 +31,7 @@ import {
ERR_OPTIMIZE_DEPS_PROCESSING_ERROR,
FS_PREFIX,
} from '../../constants'
import {
isCSSRequest,
isDirectCSSRequest,
isDirectRequest,
} from '../../plugins/css'
import { isDirectCSSRequest, isDirectRequest } from '../../plugins/css'
import { ERR_CLOSED_SERVER } from '../pluginContainer'
import { cleanUrl, unwrapId, withTrailingSlash } from '../../../shared/utils'
import {
Expand Down
4 changes: 4 additions & 0 deletions packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { VALID_ID_PREFIX } from '../shared/constants'
import {
CLIENT_ENTRY,
CLIENT_PUBLIC_PATH,
CSS_LANGS_RE,
ENV_PUBLIC_PATH,
FS_PREFIX,
OPTIMIZABLE_ENTRY_RE,
Expand Down Expand Up @@ -329,6 +330,9 @@ export const isJSRequest = (url: string): boolean => {
return false
}

export const isCSSRequest = (request: string): boolean =>
CSS_LANGS_RE.test(request)

const importQueryRE = /(\?|&)import=?(?:&|$)/
const directRequestRE = /(\?|&)direct=?(?:&|$)/
const internalPrefixes = [
Expand Down