Skip to content

optimizeDeps does not process aliased imports #8867

@danielroe

Description

@danielroe

Describe the bug

Background: In Nuxt, we need to use the CJS versions of some Vue dependencies as these will not suffer from memory leaks when running on the server. (The ESM versions should not be run on the server.) So we alias them in advance in resolve.alias.

The bug: When using the new optimizeDeps treatment in Vite, dependencies aliased to absolute paths are not processed, leading to an error like:

Error: 'isFunction' is not exported by node_modules/@vue/shared/dist/shared.cjs.prod.js, imported by src/main.js

(Possible workaround seems to be not fully resolving them.)

Reproduction

https://stackblitz.com/edit/vitejs-vite-r2pbvz

System Info

Stackblitz with:

{
  "@vue/shared": "^3.2.37",
  "vite": "~3.0.0-beta.5"
}

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions