npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@loopmode/electron-webpack-config-yarn-workspaces

v0.2.0

Published

`electron-webpack` config adjustments for yarn workspaces support.

Downloads

6

Readme

@loopmode/electron-webpack-config-yarn-workspaces

electron-webpack config adjustments for yarn workspaces support.

Usage

Pass the current configuration object to the function and use the modified return value. Always specify the path of the workspace root folder. Optionally specify a libAlias (see below).

// packages/electron-app/webpack.renderer.config.js
const configureYarnWorkspaces = require("electron-webpack-config-yarn-workspaces")
const workspaceRoot = path.resolve(__dirname, "../..")

module.exports = function(config) {
  config = configureYarnWorkspaces(config, workspaceRoot)
  return config
}

Arguments

configureYarnWorkspaces(config:object, root:string, libAlias?:string):object

config

{object} config - the current webpack configuration object.

You get this when you provide a custom electron-webpack config module that exports a function.

root

{string} root - absolute path of the workspace root (required)

This is typically two folder levels up when your file is inside {workspaceFolder}/{packageFolder}.

libAlias

{string} [libAlias] - relative path inside packages to include in alias target (optional)

If your packages transpile to their lib folders, you would normally have to type out that path when importing their modules. When you provide a libAlias: 'lib' option, you can omit the aliased part from the import path:

without libAlias

// in webpack config:
module.exports = function(config) {
  return configureYarnWorkspaces(config, workspaceRoot)
}

// later in code:
import Button from "@my/package/lib/components/Button"

with libAlias

// in webpack config:
module.exports = function(config) {
  return configureYarnWorkspaces(config, workspaceRoot, "lib")
}

// later in code:
import Button from "@my/package/components/Button"

Background

The scenario is a project using yarn workspaces and multiple apps sharing multiple modules. One workspace package is an app built with electron-webpack. Another package is an app built with create-react-app. Any number of additional packages (utils, modules, anything) exist in the workspace, and they are watched and transpiled by some tool (e.g. babel or typescript). Each of those packages gets its src/ folder transpiled to a consumable dist/.

Due to the nature of yarn workspaces, all workspace packages are symlinked into the project root's node_modules folder, and thus available to all other workspace packages.

Problem

The default setup of electron-webpack does not detect changes to files that are outside of its own directory. When the electron-webpack app runs in development mode, and you change the code of some module from a workspace package, the app does not reload the changed modules.

This is because electron-webpack employs a custom WatchFilterPlugin and uses it for ignoring changes to files that aren't part of its app's sources.

Solution

The latest versions of electron-webpack allow us to modify the webpack configuration by providing a custom configuration module that exports a function. That function is invoked with the current webpack config object, and should return a final config object.

The electron-webpack-config-yarn-workspaces solution overrides the filter function and allows files from workspace packages to be watched for changes.