pkg [options] <input> Options: -h, --help output usage information 输出使用帮助信息 -v, --version output pkg version 输出 pkg 版本信息 -t, --targets comma-separated list of targets (see examples) 以逗号分隔的目标列表(参考示例) -c, --config package.json or any json file with top-level config package.json 或者任何 json 文件顶层配置 --options bake v8 options into executable to run with them on 将 v8 选项打包到可执行文件中,以便它们一起运行 -o, --output output file name or template for several files 输出文件名或者多个文件的输出模板 --out-path path to save output one or more executables 保存输出可执行文件的路径 -d, --debug show more information during packaging process [off] 在打包过程中展示更多信息,默认关闭 -b, --build don't download prebuilt base binaries, build them 不下载预构建的基础二进制文件,而是构建它们 --public speed up and disclose the sources of top-level project 加速和公开顶级项目的源代码 --public-packages force specified packages to be considered public 强制指定包被认定为公开的 --no-bytecode skip bytecode generation and include source files as plain js 跳过字节码生成阶段,直接打包源文件为普通 js --no-native-build skip native addons build 跳过原生插件构建 --no-dict comma-separated list of packages names to ignore dictionaries. Use --no-dict * to disable all dictionaries 以逗号分隔的包名列表忽略字典,使用 --no-dict * 禁用所有字典 -C, --compress [default=None] compression algorithm = Brotli or GZip 压缩算法 Brotli 或者 GZip. 默认关闭 Examples: – Makes executables for Linux, macOS and Windows 打包 Linux, macOS 或者 Windows 的可执行文件 $ pkg index.js – Takes package.json from cwd and follows 'bin' entry 通过当前目录下的 package.json 配置的 bin 入口打包 $ pkg . – Makes executable for particular target machine 指定目标设备 $ pkg -t node14-win-arm64 index.js – Makes executables for target machines of your choice 指定多个设备和 node 版本 $ pkg -t node12-linux,node14-linux,node14-win index.js – Bakes '--expose-gc' and '--max-heap-size=34' into executable $ pkg --options "expose-gc,max-heap-size=34" index.js – Consider packageA and packageB to be public $ pkg --public-packages "packageA,packageB" index.js – Consider all packages to be public $ pkg --public-packages "*" index.js – Bakes '--expose-gc' into executable $ pkg --options expose-gc index.js – reduce size of the data packed inside the executable with GZip 通过 GZip 算法压缩可执行文件中的数据包大小 $ pkg --compress GZip index.js
标签:index,--,js,pkg,使用,packages,public From: https://www.cnblogs.com/full-stack-linux-new/p/17505676.html