You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Add support for packaging using automatically generated partial package.json support.
This should reduce greatly the artifact size in many cases.
Additional context
This should be used in conjunction with generatePackageJson option during build time.
Rational
NX-ELECTRON projects are mainly divided into two parts: frontend and backend.
Due to the nature of a monorepo project, only single 'package.json' file exists in the repository.
Modern front end platforms (e.g. angular) can overcome this issue by picking and bundling only the dependencies that are in use.
However, that's is not always the case with electron applications development.
Moreover, since electron application might use native dependencies, such tools can't be used since it is not recommended to bundle the backend project into single file.
Hence, we have a node_modules folder in the generated package, and since the dependencies tree can be huge, this reflects in the packaged app size.
On v11 we have added the functionality to dynamically generate dependencies tree to the electron backend project.
We can take leverage of this functionality in order to shake the dependency tree for the backend project.
The text was updated successfully, but these errors were encountered:
To add to what you've wrote,
it is essential to merge the existing package.json with the auto-generated one, so it will be bundled with the correct name, author etc. And in order to correctly support auto-updates, the version should be taken from the root package.json
i had this crazy idea and people still think i am crazy: use dev dep everywhere will significantly reduce your artifact size
how: you can let webpack pull all dependencies (i think some webpack plugin has abitlity to pull only required function in, anyone remember the size of momentjs? ) and put into the bundle. it is the smallest artifact you can get.
BUT, it will slow down your build a lot. however, i thnk that makes sense in a desktop app, who really needs to create 1000 builds per day? (I mean you definitely should for PR build but why would you create that many "prod" build)
This feature would be great. Are there any plans to add this? It would also allow a version from the partial package.json rather than using the nx root package.json for versioning. Unless I'm missing something?
Description
Add support for packaging using automatically generated partial
package.json
support.This should reduce greatly the artifact size in many cases.
Additional context
This should be used in conjunction with
generatePackageJson
option during build time.Rational
NX-ELECTRON projects are mainly divided into two parts: frontend and backend.
Due to the nature of a monorepo project, only single 'package.json' file exists in the repository.
Modern front end platforms (e.g. angular) can overcome this issue by picking and bundling only the dependencies that are in use.
However, that's is not always the case with electron applications development.
Moreover, since electron application might use native dependencies, such tools can't be used since it is not recommended to bundle the backend project into single file.
Hence, we have a
node_modules
folder in the generated package, and since the dependencies tree can be huge, this reflects in the packaged app size.On v11 we have added the functionality to dynamically generate dependencies tree to the electron backend project.
We can take leverage of this functionality in order to shake the dependency tree for the backend project.
The text was updated successfully, but these errors were encountered: