This is a sample of a Ruby on Rails application that is set a minimal Node.js-based JavaScript build environment without webpacker.
If your Rails application meets some of the following conditions, using this repository configuration may be more maintainable.
- Does not contain much JavaScript code.
- sprockets-rails is enough for the style-sheet build environment.
- Does not install unused npm packages.
- Manages npm packages as individually as possible so that the required packages can be updated immediately.
- Developers want to learn more basic JavaScript knowledge than webpacker.
git clone git@github.com:kjirou/minimum_javascript_on_rails.git
bin/setup
npm run build
- This command is for a stand-alone build. Mainly we use it for production release.
npm run watch
- If the
npm run watch
is running with therails server
, JavaScript source changes are applied when you reload the browser.
- If the
npm run clean
- Clean up files generated from
npm run build
ornpm run watch
.
- Clean up files generated from
- (Write later?)
- (Write later?)
Use Stimulus
- (Write later?)
- I'm sorry, I don't know well.
- You should probably search for "webpack chunk" first.