Skip to content

Commit

Permalink
fix: strip query when resolving entry (#6233)
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Jan 3, 2022
1 parent 8613423 commit 000ba2e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/playground/vue/ExternalStyleCss.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<style src="css-with-exports-field/dist/style.css"></style>
2 changes: 2 additions & 0 deletions packages/playground/vue/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</Suspense>
<ReactivityTransform :foo="time" />
<SetupImportTemplate />
<ExternalStyleCss />
</template>

<script setup lang="ts">
Expand All @@ -35,6 +36,7 @@ import ScanDep from './ScanDep.vue'
import AsyncComponent from './AsyncComponent.vue'
import ReactivityTransform from './ReactivityTransform.vue'
import SetupImportTemplate from './setup-import-template/SetupImportTemplate.vue'
import ExternalStyleCss from './ExternalStyleCss.vue'
import { ref } from 'vue'
Expand Down
3 changes: 2 additions & 1 deletion packages/playground/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"less": "^4.1.2",
"pug": "^3.0.2",
"sass": "^1.43.4",
"stylus": "^0.55.0"
"stylus": "^0.55.0",
"css-with-exports-field": "^1.0.0"
}
}
5 changes: 5 additions & 0 deletions packages/vite/src/node/plugins/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,11 @@ function resolveDeepImport(
targetWeb: boolean,
options: InternalResolveOptions
): string | undefined {
// id might contain ?query
// e.g. when using `<style src="some-pkg/dist/style.css"></style>` in .vue file
// the id will be ./dist/style.css?vue&type=style&index=0&src=xxx&lang.css
id = id.split('?')[0]

const cache = getResolvedCache(id, targetWeb)
if (cache) {
return cache
Expand Down
16 changes: 16 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 000ba2e

Please sign in to comment.