Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate module on Windows if build.rollupOptions.input is relative path #15153

Open
7 tasks done
sapphi-red opened this issue Nov 27, 2023 · 3 comments
Open
7 tasks done
Labels
has workaround p2-edge-case Bug, but has workaround or limited in scope (priority) windows only

Comments

@sapphi-red
Copy link
Member

Describe the bug

If build.rollupOptions.input is relative path, like below,

import { defineConfig } from 'vite';

export default defineConfig({
  build: {
    rollupOptions: {
      input: {
        main: 'src/main.js',
        'lib/example': 'src/lib/example.js',
      },
    },
  },
});

the module is duplicated only on Windows. (In this example, src/lib/example.js is bundled twice. (This doesn't happen with rollup)

The workaround is to call path.resolve() (e.g. path.resolve('src/lib/example.js').

Reproduction

https://stackblitz.com/edit/rollup-repro-kizyn2?file=vite.config.js

Steps to reproduce

No response

System Info

System:
    OS: Windows 11 10.0.22621
    CPU: (16) x64 13th Gen Intel(R) Core(TM) i7-1360P
    Memory: 16.73 GB / 31.62 GB
  Binaries:
    Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
    npm: 10.1.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.3.1 - C:\Program Files\nodejs\pnpm.CMD
  Browsers:
    Edge: Chromium (119.0.2151.72)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    rollup: ^4.5.0 => 4.6.0
    vite: ^5.0.2 => 5.0.2

Used Package Manager

npm

Logs

No response

Validations

@sapphi-red sapphi-red added windows only p2-edge-case Bug, but has workaround or limited in scope (priority) labels Nov 27, 2023
ferferga added a commit to jellyfin/jellyfin-vue that referenced this issue Jan 1, 2024
Workaround sourced from vitejs/vite#15153

Signed-off-by: Fernando Fernández <ferferga@hotmail.com>
ferferga added a commit to jellyfin/jellyfin-vue that referenced this issue Jan 1, 2024
Workaround sourced from vitejs/vite#15153

Signed-off-by: Fernando Fernández <ferferga@hotmail.com>
ferferga added a commit to jellyfin/jellyfin-vue that referenced this issue Jan 1, 2024
Workaround sourced from vitejs/vite#15153

Signed-off-by: Fernando Fernández <ferferga@hotmail.com>
@HawtinZeng
Copy link

Can't find the difference between vite bundles and rollup bundles in the reproduction project, nor the duplicate module.
image

@sapphi-red
Copy link
Member Author

This only happens on Windows. Did you try it on Windows?
image

@HawtinZeng
Copy link

HawtinZeng commented Feb 27, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has workaround p2-edge-case Bug, but has workaround or limited in scope (priority) windows only
Projects
None yet
Development

No branches or pull requests

2 participants