Skip to content

build.lib overwrites build.rollupOptions.input in v3 #9086

@SteveDesmond-ca

Description

@SteveDesmond-ca

Describe the bug

I have a vite config that builds and outputs multiple files in "library mode". (see minimal repro) It works fine in vite v2, but fails in vite v3.

Steps to reproduce:

  1. load reproduction URL
  2. npm i and npm run vite to see successful case in v2
  3. update vite in package.json to 3.0.0
  4. npm i and npm run vite to see failed case in v3

Note I've also tried just putting 1 of the files as the lib.entry, and alternatively creating a "dummy" single file (e.g. blank.ts) as the entry point, while keeping the list of files in rollupOptions.input. It seems the rollupOptions.input is ignored in v3, as it's only building the file in lib.entry.

Reproduction

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

System Info

Note that this also fails in Linux environments, such as StackBlitz

  System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
    Memory: 22.45 GB / 31.95 GB
  Binaries:
    Node: 16.13.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (103.0.1264.49)
  npmPackages:
    vite: 3.0.0 => 3.0.0

Used Package Manager

yarn and/or npm

Logs

vite v2

$ vite build .
vite v2.9.14 building for production...
✓ 2 modules transformed.
dist/file1.cjs.js   0.04 KiB / gzip: 0.06 KiB
dist/file2.cjs.js   0.04 KiB / gzip: 0.06 KiB

vite v3

$ vite build .
vite v3.0.0 building for production...
✓ 0 modules transformed.
Could not resolve entry module (*.ts).
error during build:
Error: Could not resolve entry module (*.ts).
    at error (file:///X:/vite3-repro/node_modules/rollup/dist/es/shared/rollup.js:1858:30)
    at ModuleLoader.loadEntryModule (file:///X:/vite3-repro/node_modules/rollup/dist/es/shared/rollup.js:22396:20)
    at async Promise.all (index 0)
error Command failed with exit code 1.

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: library modep3-downstream-blockerBlocking the downstream ecosystem to work properly (priority)regressionThe issue only appears after a new release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions