nx-extensions icon indicating copy to clipboard operation
nx-extensions copied to clipboard

fix(vite): correct fileReplacements property names

Open iruszpel opened this issue 3 years ago • 2 comments

function replaceFiles expects input of type { file: string; with: string } but current schema declares { replace: string; with: string }

iruszpel avatar Aug 16 '22 10:08 iruszpel

Nx Cloud Report

CI is running for commit 9fc778a5f6f34381e41d4224bd960e6f104c6ac5.

📂 Click to track the progress, see the status, the terminal output, and the build insights.


Sent with 💌 from NxCloud.

nx-cloud[bot] avatar Aug 16 '22 10:08 nx-cloud[bot]

I've also run into this issue with file replacement. Was just about to open an issue on this, but noticed there's already a PR to fix! Are there plans to merge/release this change in the future?

elizabethhart avatar Sep 21 '22 13:09 elizabethhart

@DominikPieper I was thinking vite and NX now support just environmental vars. Should we follow in same direction?

Jordan-Hall avatar Oct 10 '22 21:10 Jordan-Hall

Just ran into this myself. Great it is being fixed!

However, it seems to me the convention of @nrwl packages is to use replace in stead of file. So perhaps it is better to keep the schema and change the argument name of the replace plugin?

grundius avatar Nov 02 '22 16:11 grundius

@DominikPieper I was thinking vite and NX now support just environmental vars. Should we follow in same direction?

I actually use this feature to either inject a mock backend or a real backend depending on config. I could make the switch based on an environment var but that would mean some more complex logic as I do not want to package the mock backend, which includes faker into the production bundle. With file replacements I do not have to worry about that.

grundius avatar Nov 02 '22 16:11 grundius

Removing functionality in support of NX, Thank you @iruszpel for this PR though, its much appreciated

Jordan-Hall avatar Nov 18 '22 08:11 Jordan-Hall