![]() ![]() If you want to generate executable for different architectures, Linux,macos,win for current Node.js version and arch. There is also an alias host, that means that all 3 elementsĪre taken from current platform/Node.js. System-wide Node.js installation (its version and arch). The omitted elements will be taken from current platform or You may omit any element (and specify just node14 for example). (element) is unsupported, but you may try to compile yourself. platform alpine, linux, linuxstatic, win, macos, (freebsd).nodeRange (node8), node10, node12, node14, node16 or latest.A canonical target consists of 3 elements, separated byĭashes, for example node18-macos-圆4 or node14-linux-arm64: You can specify a comma-separated list of targets via -targets Pkg can generate executables for several target machines at a The specified package.json and use it as entry file. Packaged app will work the same way as node /path/app.js The entrypoint of your project is a mandatory CLI argument. – Makes executable for particular target machine $ pkg -t node16-win-arm64 index.js – Makes executables for target machines of your choice $ pkg -t node16-linux,node18-linux,node16-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 $ pkg -compress GZip index.js ![]() Use -no-dict * to disable all dictionaries -C, -compress compression algorithm = Brotli or GZip Examples: – Makes executables for Linux, macOS and Windows $ pkg index.js – Takes package.json from cwd and follows 'bin' entry $ pkg. Pkg Options: -h, -help output usage information -v, -version output pkg version -t, -targets comma-separated list of targets (see examples) -c, -config package.json or any json file with top-level config -options bake v8 options into executable to run with them on -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 -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 -no-native-build skip native addons build -no-signature skip signature of the final executable on macos -no-dict comma-separated list of packages names to ignore dictionaries. Test your app against new Node.js version without installing it.Put your assets inside the executable to make it even more portable.No need to download hundreds of files via npm install to deploy.No need to install Node.js and npm to run the packaged application.Make some kind of self-extracting archive or installer.Instantly make executables for other platforms (cross-compilation).Make a demo/evaluation/trial version of your app without sources.Make a commercial version of your application without sources.This command line interface enables you to package your Node.js project into an executable that can be run even on devices without Node.js installed. For those using Vercel, this means that there is no requirement to use pkg in your projects as the benefits it provides are not applicable to the platform. The entrypoints file is needed only if you're usingĬertain optional features, like splitEntr圜hunks().Disclaimer: pkg was created for use within containers and is not intended for use in serverless environments. Instead, you can point directly to the final built files or write code to parseĮntrypoints.json manually. If you are not using Symfony you won't have the encore_entry_* functions available. ![]() More files), all the necessary script and link tags will render automatically. Template: the paths in entrypoints.json will always be the final, correct paths.Īnd if you use splitEntr圜hunks() (where Webpack splits the output into even Point assets to a CDN without making any changes to your This file is especially useful because you can Read from a public/build/entrypoints.json file that's generated by Encore to know the exactįilename(s) to render. The encore_entry_link_tags() and encore_entry_script_tags() functions All the CSS files that were required will also be displayed. That's it! When you refresh your page, all of the JavaScript fromĪssets/app.js - as well as any other JavaScript files it included - willīe executed. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |