...

/

Setting Up Javascript Unit-Test

Setting Up Javascript Unit-Test

Learn about Webpack configuration, JavaScript dependencies, and adding modules to dev dependencies.

Webpack configuration

This is going to be a bit involved, unfortunately. Rails 5.1 or later uses the Webpacker gem, which allows us to bypass the Rails asset pipeline and use Webpack, which is an asset-bundling tool commonly used by JavaScript developers. Webpack allows us to do all the same things the old Rails asset pipeline does: module lookup, compilation, conversion to a single minified file, and so on. But Webpack is more integrated with current JavaScript tools and makes it much easier to integrate with JavaScript code that is distributed using the Node ...