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
So when I run nx build desktop-app-main, it checks if options.assets is truthy (it is), and tries to init the copy-webpack-plugin.
Since the array is empty, copy-webpack-plugin throws an error:
Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
- options.patterns should be an non-empty array.
I can patch the nx-electron builder easily to get the desired result:
- if (options.assets) {+ if (options.assets && options.assets.length >= 1) {
Adding any kind of "stub" file/folder to the assets array fixes the issue too 😃
But I think ultimately, it would be nice to not throw an error if someone does the same thing as I did.
Note: I noticed when I tried to reproduce with a fresh workspace above that by default nx-electron inits an empty assets folder, so I guess this would only happen if someone tries to delete the assets config line (and forgets about it).
Expected behavior
I expect to be able to build the main app using nx build desktop-app-main even if no asset config is specified.
Screenshots
I attached some screenshots above.
Desktop (please complete the following information):
OS: Ubuntu via Windows WSL2
Nx Electron Version v11.0.0
The text was updated successfully, but these errors were encountered:
patdx
added a commit
to patdx/nx-electron
that referenced
this issue
Mar 12, 2021
Describe the bug
I upgraded an nx-electron app to v11 which was working fine before. It has a config like below:
I guess there was previously an assets setting which I deleted since I was not using it.
Seems like even if it is gone, in the builder it is normalized to an empty array. Probably it gets normalized based on this schema.json?
nx-electron/src/builders/build/schema.json
Line 37 in f741582
So when I run
nx build desktop-app-main
, it checks ifoptions.assets
is truthy (it is), and tries to init the copy-webpack-plugin.Since the array is empty, copy-webpack-plugin throws an error:
I can patch the nx-electron builder easily to get the desired result:
Adding any kind of "stub" file/folder to the assets array fixes the issue too 😃
But I think ultimately, it would be nice to not throw an error if someone does the same thing as I did.
To Reproduce
npm install
and thennpx nx build main
Note: I noticed when I tried to reproduce with a fresh workspace above that by default nx-electron inits an empty assets folder, so I guess this would only happen if someone tries to delete the
assets
config line (and forgets about it).Expected behavior
I expect to be able to build the main app using
nx build desktop-app-main
even if no asset config is specified.Screenshots
I attached some screenshots above.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: