Hello!
How can I exclude node_modules from building? I need to build only project sources only.
I'm not sure I understand your use case.
The purpose of ncc is to bundle the parts of node_modules that your code uses and exclude the parts it does not use.
You can exclude node_modules by avoiding the use of require('third-party-pkg') in your source code file that is passed to ncc.
So, my purpose was to package only project sources to one bundle, except third-party modules. I found solution in doing it via ncc API.
There is a --external flag you can use.
Something like ncc build index.js -e third-party-pkg
https://github.com/zeit/ncc/issues/274#issuecomment-463436176
Yes, but I needed to exclude all external modules, and easiest way for me was to readdir node_modules and put it to ncc's externals parameter via JS script.
Most helpful comment
Yes, but I needed to exclude all external modules, and easiest way for me was to readdir
node_modulesand put it to ncc's externals parameter via JS script.