How to include a dependency tree in an Angular + NW.js project?

31 views Asked by At

In my Angular project, I'm using code references to Node dependencies in the format like this: let zl = nw.require('zip-lib');. However, when I'm building the project, it seems like Angular CLI doesn't detect that I'm using this dependency, resulting in the zip-lib not being included in the bundle file after building.

How can I manually specify zip-lib and all its sub-dependencies in a way that Angular CLI recognizes this dependency and its sub-dependencies and includes them in the bundle file after building?

1

There are 1 answers

1
The Jared Wilcurt On BEST ANSWER

That library requires zlib which is a native node module. You can't use web bundling tools to bundle a desktop app, because desktop code will not be bundled.

Also there isn't really much value in bundling and saving a few kilobytes if you are still shipping hundreds of megabytes for the run time.

More: