lib/install/webpack/install.rb in jsbundling-rails-0.1.8 vs lib/install/webpack/install.rb in jsbundling-rails-0.1.9
- old
+ new
@@ -1,6 +1,12 @@
say "Install Webpack with config"
copy_file "#{__dir__}/webpack.config.js", "webpack.config.js"
run "yarn add webpack webpack-cli"
say "Add build script"
-run %(npm set-script build "webpack --config webpack.config.js")
+build_script = "webpack --config webpack.config.js"
+
+if (`npx -v`.to_f < 7.1 rescue "Missing")
+ say %(Add "scripts": { "build": "#{build_script}" to your package.json), :green
+else
+ run %(npm set-script build "#{build_script}")
+end