Skip to content

Bug when rewriting relative import in un-optimized node_modules #204

@csr632

Description

@csr632

Do NOT ignore this template or your issue will have a very high chance to be closed without comment.

Describe the bug

In this line, the ctx.path may be a direcory.
https://github.com/vuejs/vite/blob/6683bb8fb819c6f4935b40f25c2a377037e5ec7d/src/node/server/serverPluginModuleRewrite.ts#L129

But when you resolve relative import, you treat it as a file path.
https://github.com/vuejs/vite/blob/49a44b648f263ff058f730913ea1ee6c62e3cd2d/src/node/utils/pathUtils.ts#L16

For example, if /dir/index.js have import './utils', and browser request for /dir, vite will try to find utils from /utils instead of /dir/utils

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions