Skip to content

Commit

Permalink
fix: ?import with trailing = added by some servers (#3805)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3dotgg committed Jun 16, 2021
1 parent 3d5c697 commit 460d1cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/importAnalysis.ts
Expand Up @@ -222,7 +222,7 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
// for relative js/css imports, inherit importer's version query
// do not do this for unknown type imports, otherwise the appended
// query can break 3rd party plugin's extension checks.
if (isRelative && !/[\?&]import\b/.test(url)) {
if (isRelative && !/[\?&]import=?\b/.test(url)) {
const versionMatch = importer.match(DEP_VERSION_RE)
if (versionMatch) {
url = injectQuery(url, versionMatch[1])
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/utils.ts
Expand Up @@ -118,7 +118,7 @@ export const isJSRequest = (url: string): boolean => {
return false
}

const importQueryRE = /(\?|&)import(?:&|$)/
const importQueryRE = /(\?|&)import=?(?:&|$)/
const trailingSeparatorRE = /[\?&]$/
export const isImportRequest = (url: string): boolean => importQueryRE.test(url)

Expand Down

0 comments on commit 460d1cd

Please sign in to comment.