-
Notifications
You must be signed in to change notification settings - Fork 34
devDependencies are part of the binary #12
Comments
This looks like a bug in caxa. Caxa should install the dev dependencies but prune them right before packaging. |
After some more tests, I've found out that this is only true on Linux, but not on Windows. On Windows, my workaround does not work, because deleting the
Please forget the previous section, the size difference is because of the |
I can confirm that this is definitely happening on Linux. @renkei my workaround fixes the problem but it makes the whole process slower and can become a problem if you're source code is very big (not including output_dir='build'
include_list="
src/
package.json
package-lock.json"
mkdir -p $output_dir
echo "$include_list" | rsync -arc --files-from=- . "$output_dir"
cd $output_dir
npm ci --production
cd -
npx caxa -d $output_dir -c "{{caxa}}/node_modules/.bin/node" "{{caxa}}/src/index.js" -o output You can play with You can even run this as an npm script, which has the added benefits of having access to You can see that it's slower because you have to copy files and run |
@leafac After further testing, I've realized that PR #8 could also fix this issue, but I think that PR is targeted at introducing a new feature rather than fixing this issue. It just happens to fix this issue as a side effect. |
Hi all, First, thanks for the bug report and for all the investigative work. You really made it easy for me to fix the issue 😃 This has been fixed as part of v2.0.0. There are actually two solutions:
Let me know how it works for you. |
Oh, and by the way, v2.0.0 also includes support for Linux ARM! @renkei, I hope you like this 😃 |
@leafac
What a cool project! Thank you very much for your work on this. Once ARM support is ready it is a very interesting alternative to
pkg
although the source code is not hidden and must be evaluated first.After some tests with my project on Linux I found out that all of my devDependencies are part of the resulting binary (file size is ca. 42 MB, ca. 160 MB after extraction). In the README you write:
but this seems not to be the case for me. My current workaround:
npm install -g caxa
node_modules
folder of my project, it seems to be unused by caxadevDependencies
section in mypackage.json
dependencies
frompackage.json
in the build directory of caxa.Now, I get a working binary with file size of ca. 15 MB (ca. 39 MB after extraction). The result is impressive. Is there something wrong with this approach to avoid the devDependencies?
The text was updated successfully, but these errors were encountered: