Skip to content

Dynamic import module build problem #6250

@sanyuan0704

Description

@sanyuan0704

Describe the bug

Dynamic import module cannot seperate source code and dependencies code after build.Inside vite, only the dependencies of non-dynamically imported modules will be packaged into the vendor. But for dynamically imported modules, their dependencies will be packaged with the application code, resulting in a decrease in the cache hit rate.

Reproduction

https://github.com/sanyuan0704/vite-dymaic-import-bundle-problem

image

System Info

System:
    OS: macOS 11.2
    CPU: (8) arm64 Apple M1
    Memory: 141.80 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Chrome: 96.0.4664.110
    Safari: 14.0.3
  npmPackages:
    @vitejs/plugin-react: ^1.0.0 => 1.1.0 
    vite: ^2.7.6 => 2.7.6

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions