Skip to content

Commit

Permalink
fix: ensure consistent module entry urls by removing import query
Browse files Browse the repository at this point in the history
fix #1321
  • Loading branch information
yyx990803 committed Jan 4, 2021
1 parent f6e7c0f commit 2b82e84
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/vite/src/node/server/moduleGraph.ts
@@ -1,6 +1,11 @@
import { extname } from 'path'
import { isDirectCSSRequest } from '../plugins/css'
import { cleanUrl, normalizePath, removeTimestampQuery } from '../utils'
import {
cleanUrl,
normalizePath,
removeImportQuery,
removeTimestampQuery
} from '../utils'
import { TransformResult } from './transformRequest'
import { PluginContainer } from './pluginContainer'
import { parse as parseUrl } from 'url'
Expand Down Expand Up @@ -155,7 +160,7 @@ export class ModuleGraph {
// 2. resolve its extension so that urls with or without extension all map to
// the same module
async resolveUrl(url: string): Promise<[string, string]> {
url = removeTimestampQuery(url)
url = removeImportQuery(removeTimestampQuery(url))
const resolvedId = (await this.container.resolveId(url))?.id || url
const ext = extname(cleanUrl(resolvedId))
const { pathname, search, hash } = parseUrl(url)
Expand Down

0 comments on commit 2b82e84

Please sign in to comment.