How nx-electron determines what node_modules to copy? #184
-
Hey, I probably have a special use case, but I'll try to get some help anyway. Let's say that I have an app called "test-app-web" (React, Vue, doesn't matter) and that's the frontend app. Then I have "test-app-desktop" and that's an Electron app created using nx-electron. Now, I do want to use "test-app-web" during local development, but when packaging the desktop app I do not want to package "test-app-web" into the desktop app since I would like to just directly use I added Is there a way to ignore dependencies from that frontend app with nx-electron? I looked into code, but wasn't sure where this is handled. If you can point me in the right direction, I'm willing to create a local patch in my repo using patch-package to add this functionality or just to work around it somehow, but I just need some guidance where to look at 😄 I'm using nx-electron v12 btw. Cannot update to the latest one at the moment. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In newer versions you can create an application without a frontend, in v12 the compiled frontend will be copied to the packaged app. |
Beta Was this translation helpful? Give feedback.
In newer versions you can create an application without a frontend, in v12 the compiled frontend will be copied to the packaged app.
However, you should be able to ignore it from the package using the files field in the
maker.options.json
(same as you did).Furthermore, you can use the
--generatePackageJson
option to improve the desktop app modules tree shacking (i.e.nx build test-app-desktop --configuration=production --generatePackageJson
).Finally, you can ignore specific stray modules (i.e.
"files": ["!**/node_modules/moment"]
).