Skip to content
Merged
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
6 changes: 3 additions & 3 deletions packages/vite/bin/vite.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const profileIndex = process.argv.indexOf('--profile')

if (debugIndex > 0) {
let value = process.argv[debugIndex + 1]
if (!value || value.startsWith('-')) {
if (!value || value[0] === '-') {
value = 'vite:*'
} else {
// support debugging multiple flags with comma-separated list
Expand All @@ -39,7 +39,7 @@ if (debugIndex > 0) {

if (filterIndex > 0) {
const filter = process.argv[filterIndex + 1]
if (filter && !filter.startsWith('-')) {
if (filter && filter[0] !== '-') {
process.env.VITE_DEBUG_FILTER = filter
}
}
Expand All @@ -65,7 +65,7 @@ function start() {
if (profileIndex > 0) {
process.argv.splice(profileIndex, 1)
const next = process.argv[profileIndex]
if (next && !next.startsWith('-')) {
if (next && next[0] !== '-') {
process.argv.splice(profileIndex, 1)
}
const inspector = await import('node:inspector').then((r) => r.default)
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/assetImportMetaUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin {
const templateLiteral = (ast as any).body[0].expression
if (templateLiteral.expressions.length) {
const pattern = buildGlobPattern(templateLiteral)
if (pattern.startsWith('*')) {
if (pattern[0] === '*') {
// don't transform for patterns like this
// because users won't intend to do that in most cases
continue
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/importMetaGlob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ export async function toAbsoluteGlob(
root = globSafePath(root)
let dir
if (base) {
if (base.startsWith('/')) {
if (base[0] === '/') {
dir = posix.join(root, base)
} else {
dir = posix.resolve(
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/server/middlewares/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export function transformMiddleware(
const result = await environment.transformRequest(url, {
allowId(id) {
return (
id.startsWith('\0') ||
id[0] === '\0' ||
!isServerAccessDeniedForTransform(server.config, id)
)
},
Expand Down
Loading