Skip to content

When the file path is an absolute path, injectQuery will clear the parameters. #10448

@yzydeveloper

Description

@yzydeveloper

Describe the bug

I'm bringing an unbuilt and published component library into the project to use.
But when I go to reference the components in this component library, vite:resolve will clear the parameters of the .vue file path, causing plugin-vue to fail to resolve correctly

Error: Uncaught SyntaxError: The requested module '/node_modules/@ui/components/Test.vue?v=7ab6c6de' does not provide an export named 'render' (at Test.vue?v=7ab6c6de:2:10)

// file url
E:/_yzydeveloper/vite-resolve-url-encode/node_modules/@ui/components/Test.vue?vue&type=template&lang.js

// resolve normal
import { render as __vue2_render, staticRenderFns as __vue2_staticRenderFns } from "/node_modules/@ui/components/Test.vue?v=7ab6c6de&vue&type=template&lang.js"

// resolve error
import { render as __vue2_render, staticRenderFns as __vue2_staticRenderFns } from "/node_modules/@ui/components/Test.vue?v=7ab6c6de"

Reproduction

https://github.com/yzydeveloper/vite-resolve-url-encode-demo

Steps to reproduce

Run pnpm install, then pnpm run dev

System Info

System:
    OS: Windows 10 10.0.19043
    CPU: (4) x64 Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz
    Memory: 2.60 GB / 7.89 GB
  Binaries:
    Node: 16.9.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 2.4.3 - ~\node_modules\.bin\yarn.CMD
    npm: 7.22.0 - ~\AppData\Roaming\npm\npm.CMD
  Browsers:
    Chrome: 106.0.5249.103
    Edge: Spartan (44.19041.1266.0), Chromium (106.0.1370.42)
    Internet Explorer: 11.0.19041.1566

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions