0.01
Low commit activity in last 3 years
No release in over a year
webpacker-pnpm minimizes dependency hell, improves code quality stability, and reduces node_modules folder sizes by replacing Webpacker's Yarn environment with pnpm.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 5.2
>= 12.3.3
 Project Readme

webpacker-pnpm

version status downloads license Buy a tree

webpacker-pnpm replaces Rails' Yarn environment with pnpm, a better, smarter, and more efficient Node.js package manager. As a result, applications become less prone to dependency hell, more functional, more stable, and more flexible. And as an added bonus, dependency resolution times and node_modules folder sizes reduce to within reasonable ranges (not 45 seconds and 10 GiB).

You can read about the philosophy and technology behind pnpm in this convincing blog post by Zoltan Kochan (https://www.kochan.io/nodejs/why-should-we-use-pnpm).

Features

  • Production-ready
  • Drop-in replacement for Yarn
  • Supports Rails' Template API, including existing templates using Yarn
  • Provides code sanity without the migraines
  • Gives you more disk space

Installation

In order to use webpacker-pnpm, you must install pnpm. The official instructions are here.

After installing pnpm, first add webpacker-pnpm to your app's Gemfile.

gem "webpacker-pnpm"

Secondly, add the following line to your ./bin/webpack so it looks like below (the order matters). This step is required as Webpacker spawns a new process isolated from the Rails server (and thus all auto-loaded patches) when compilation happens live.

require "webpacker/webpack_runner"
require "webpacker/pnpm/patches" if ENV["RAILS_ENV"] != "production"

If you know of an automatic way of achieving a similar result, please open an Issue or PR with your suggestion.

License

This software is licensed under the BSD 3-Clause License.

This package is Treeware. If you use it in production, consider buying the world a tree to thank me for my work. By contributing to my forest, you’ll be creating employment for local families and restoring wildlife habitats.