Open toteto opened 5 months ago
I'm facing same problems.
I'm facing same problems.
Workaround, I am just excluding the file from being deployed to the server. Recommend you do the same for now.
@toteto
You're right, I do something similar, but the bug
is... quite frustrating.
But thx!
I'm facing same problems.
Workaround, I am just excluding the file from being deployed to the server. Recommend you do the same for now.
@toteto Just add "generatePackageJson": false
in the options
of your build
target that is using @nx/vite:build
executor.
@Aimen-Khalid it's not really working for me
"@nx/vite": "^19.5.6",
"nx": "19.5.6",
Maybe this is the fix? https://github.com/nrwl/nx/pull/19780
Current Behavior
I have React web app that is bundled with Vite. When bundling directly with the
vite build
the build output doesn't containpackage.json
file. When building with the nx/vite:build executor, somewhere along the linespackage.json
is included.This file is not coming from the
vite build
step since the file is not being mentioned in the Vite console output.Expected Behavior
No
package.json
is being outputed for web apps because it doesn't play any role. Since most often thedist
directory is directly being served by a server, thepackage.json
might end up being accessible by the public too.While this doesn't create direct security risk, it creates an indirect one by having the application dependancies and scripts available to the public.
Each app developer now has to make sure that this file is ignored/protected. Think it would be easier if nx/vite:build didn't copy this file at all.
GitHub Repo
https://github.com/toteto/nx-vite-react-example
Steps to Reproduce
npx create-nx-workspace@latest --preset=react-standalone --bundler=vite
. Or checkout the example repo.npm build
Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response