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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@driver-digital/vite-plugin-shopify-clean

v1.1.2

Published

Vite plugin for correctly cleaning up an assets folder

Readme

@driver-digital/vite-plugin-shopify-clean

Vite plugin that cleans up your Shopify theme assets/ folder across builds and during watch (HMR). It is designed to be used alongside Barrel's Shopify Vite Plugin.

Why you might need this: when Vite emits hashed filenames (e.g., app-abc123.js), older hashed files can accumulate over time. This plugin removes outdated assets safely so your assets/ directory stays tidy and your theme only references current files.

GitHub

npm

Issues

Changelog

Features

  • Cleans pre-existing assets listed in the last manifest at the start of a build.
  • Removes stale assets after each build by comparing the previous manifest to the current one — in both dev (watch) and production builds.
  • Tracks JS, CSS, and asset files (images, fonts, etc.) from the manifest.
  • Uses Rollup/Vite watchMode (no env var required) to control watch-specific behavior.
  • Works with the Shopify theme assets directory structure.
  • Minimal configuration; sensible defaults.

Installation

npm i -D @driver-digital/vite-plugin-shopify-clean

Peer requirements:

  • Node.js: >=18
  • Vite: >=5

Usage

Add the plugin to your Vite config alongside Barrel's Shopify Vite Plugin.

// vite.config.js
import { defineConfig } from 'vite'
import shopify from 'vite-plugin-shopify'
import shopifyClean from '@driver-digital/vite-plugin-shopify-clean'

export default defineConfig({
  build: {
    emptyOutDir: false,
    sourcemap: true
  },
  plugins: [
    shopifyClean({
      // themeRoot: './',
      // manifestFileName: '.vite/manifest.json',
    }),
    shopify({
      tunnel: true,
      themeRoot: ".",
      sourceCodeDir: "frontend"
    })
  ],
})

Notes:

  • When outputting directly to your Shopify theme assets/ folder, set build.emptyOutDir: false. The plugin relies on the previous build's files and manifest to determine what to remove. If Vite empties the directory first, there is nothing to compare and the cleanup cannot run as intended (and you generally don't want Vite to wipe your theme assets).
  • The plugin expects a Vite manifest to exist within your theme assets/ directory (by default at assets/.vite/manifest.json). If your integration writes the manifest elsewhere, configure manifestFileName or themeRoot accordingly.
  • In watch mode, the plugin automatically handles cleanup as new files are emitted.

Options

interface VitePluginShopifyCleanOptions {
  /**
   * Relative location of the manifest inside the theme's assets directory.
   * Defaults to `.vite/manifest.json` (resolved under `assets/`).
   */
  manifestFileName?: string

  /**
   * Shopify theme root directory (relative to project root).
   * Defaults to `./`.
   */
  themeRoot?: string
}

Defaults used by the plugin:

  • manifestFileName: .vite/manifest.json
  • themeRoot: ./

How it works

The plugin tracks files listed in Vite's manifest (JS, CSS, and asset files like images and fonts) and uses manifest comparison to determine what to clean.

  • Build start (buildStart)
    • If assets/.vite/manifest.json exists (or your configured path), the plugin reads the previously emitted assets and removes them from assets/ before a fresh build. This prevents stale files from lingering across builds.
  • Write bundle (writeBundle)
    • After new assets are written, the plugin compares the previous manifest to the current one. Any files that were in the old manifest but are no longer in the new manifest are deleted. This handles cases where entry points are renamed or removed between builds.

Changelog

See CHANGELOG.md for release notes.

License

MIT

Acknowledgements

Built and maintained with ♥️ by Driver Digital

Originally forked from @by-association-only/vite-plugin-shopify-clean - big thanks to Dan Gamble for his work on the original.