Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rails/webpacker

Package Overview
Dependencies
Maintainers
8
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rails/webpacker

Use webpack to manage app-like JavaScript modules in Rails

  • 5.4.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
217K
decreased by-28.16%
Maintainers
8
Weekly downloads
 
Created

What is @rails/webpacker?

@rails/webpacker is a gem that integrates Webpack with Ruby on Rails, allowing you to use modern JavaScript tooling and libraries in your Rails application. It provides a standard way to manage JavaScript, CSS, and other assets in a Rails project.

What are @rails/webpacker's main functionalities?

JavaScript Bundling

Webpacker allows you to bundle JavaScript files. The configuration specifies the entry point and the output location for the bundled file.

module.exports = {
  entry: './app/javascript/packs/application.js',
  output: {
    filename: 'bundle.js',
    path: __dirname + '/public/packs'
  }
};

CSS and Asset Management

You can manage CSS and other assets like images and fonts. This example shows how to import a custom stylesheet and a Bootstrap CSS file.

import '../stylesheets/application';
import 'bootstrap/dist/css/bootstrap';

Hot Module Replacement

Webpacker supports Hot Module Replacement (HMR) for a better development experience. This configuration enables HMR and sets the content base directory.

module.exports = {
  devServer: {
    hot: true,
    contentBase: './public/packs'
  }
};

Integration with Rails

Webpacker integrates seamlessly with Rails views. You can use helper methods to include JavaScript and CSS packs in your Rails templates.

<%= javascript_pack_tag 'application' %>
<%= stylesheet_pack_tag 'application' %>

Other packages similar to @rails/webpacker

FAQs

Package last updated on 13 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc