plugins { id "com.github.node-gradle.node" version "3.1.1" } node { // Whether to download and install a specific Node.js version or not // If false, it will use the globally installed Node.js // If true, it will download node using above parameters // Note that npm is bundled with Node.js download = true // Version of node to download and install (only used if download is true) // It will be unpacked in the workDir version = '16.13.0' } task build() { dependsOn npm_run_build } npm_run_build { // make sure the build task is executed only when appropriate files change inputs.files fileTree('public') inputs.files fileTree('src') // 'node_modules' appeared not reliable for dependency change detection (the task was rerun without changes) // though 'package.json' and 'package-lock.json' should be enough anyway inputs.file 'package.json' inputs.file 'package-lock.json' outputs.dir 'dist' } npm_run_serve { }