rails / jsbundling-rails

Bundle and transpile JavaScript in Rails with esbuild, rollup.js, or Webpack.
MIT License
831 stars 144 forks source link

set-script has been removed from npm 9 #138

Closed jcoyne closed 1 year ago

jcoyne commented 1 year ago
Add build script
         run  npm set-script build "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets" from "."
Unknown command: "set-script"
npm --version
9.0.0

It is used here: https://github.com/rails/jsbundling-rails/blob/5e6758f077f0be59f94ea34678c2f8c452f2ba32/lib/install/esbuild/install.rb#L10

pandancode commented 1 year ago

The below should work in the console

$ npm pkg set scripts.build="webpack --config webpack.config.js"

Should be a simple fix in the code base:

Replace

run %(npm set-script build "#{build_script}")

with

run %(npm pkg set scripts.build="#{build_script}")