Skip to content

Commit

Permalink
fix: edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
poyoho committed May 10, 2022
1 parent b987e85 commit e715d41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/vite/src/node/plugins/dynamicImportVars.ts
Expand Up @@ -4,7 +4,7 @@ import { init, parse as parseImports } from 'es-module-lexer'
import type { ImportSpecifier } from 'es-module-lexer'
import type { Plugin } from '../plugin'
import type { ResolvedConfig } from '../config'
import { normalizePath, parseRequest } from '../utils'
import { normalizePath, parseRequest, requestQuerySplitRE } from '../utils'
import { parse as parseJS } from 'acorn'
import { createFilter } from '@rollup/pluginutils'
import { dynamicImportToGlob } from '@rollup/plugin-dynamic-import-vars'
Expand Down Expand Up @@ -51,8 +51,8 @@ function parseDynamicImportPattern(
return null
}

const [userPattern] = userPatternQuery.split('?', 2)
const [rawPattern] = filename.split('?', 2)
const [userPattern] = userPatternQuery.split(requestQuerySplitRE, 2)
const [rawPattern] = filename.split(requestQuerySplitRE, 2)

if (rawQuery?.raw !== undefined) {
globParams = { as: 'raw' }
Expand Down
1 change: 1 addition & 0 deletions packages/vite/src/node/utils.ts
Expand Up @@ -723,6 +723,7 @@ export function toUpperCaseDriveLetter(pathName: string): string {

export const multilineCommentsRE = /\/\*(.|[\r\n])*?\*\//gm
export const singlelineCommentsRE = /\/\/.*/g
export const requestQuerySplitRE = /\?(?!.*[\/|\}])/

export const usingDynamicImport = typeof jest === 'undefined'
/**
Expand Down

0 comments on commit e715d41

Please sign in to comment.