Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Plugins with multiple builds clobber each other #15517

Closed
7 tasks done
mkilpatrick opened this issue Jan 5, 2024 · 0 comments
Closed
7 tasks done

Plugins with multiple builds clobber each other #15517

mkilpatrick opened this issue Jan 5, 2024 · 0 comments

Comments

@mkilpatrick
Copy link

mkilpatrick commented Jan 5, 2024

Describe the bug

I have a custom plugin that handles the main build (multiple entires with chunking, etc). I would like to also perform a second [lib] build that compiles each [different from build 1] entry into a single output file, and also places them in the final dist location (though different subfolder) that the first build outputs to. Note that both builds have very different build configs. If my plugin uses its own plugin for build 2 it results in one clobbering the other. Fortunately, we have our own build executable so I can get around this by doing:

import {build} from "vite";
import {secondBuild} from "../foo.js"; // calls vite build()

await build(); // uses my plugin
await secondBuild(); // sets configFile to false

The downside with my workaround is that any config sent to my plugin is inaccessible to my second build since it's not actually using my plugin that users would add to their vite.config.js.

Ideally, I could write a plugin that has a multi-step build process that executes in a defined order.

Tangentially, would love to see this issue get some love. The workaround is to perform a build per entry like described here.

Reproduction

N/A

Steps to reproduce

No response

System Info

System:
    OS: macOS 12.6
    CPU: (10) arm64 Apple M1 Max
    Memory: 764.28 MB / 64.00 GB
    Shell: 5.2.21 - /usr/local/bin/bash
  Binaries:
    Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.4.1 - /opt/homebrew/bin/npm
    pnpm: 8.8.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 120.0.6099.199
    Safari: 16.4.1
  npmPackages:
    @vitejs/plugin-react: ^4.2.1 => 4.2.1 
    vite: 5.0.9 => 5.0.9

Used Package Manager

npm

Logs

No response

Validations

@vitejs vitejs locked and limited conversation to collaborators Jan 8, 2024
@bluwy bluwy converted this issue into discussion #15537 Jan 8, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

1 participant