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

@imagexmedia/vite

v1.0.3

Published

The ImageX SWAT Vite package.

Readme

SWAT Vite

Provides ready to use Vite dependencies and configurations.

Configuration

Vite can be configured in basic or advanced modes, or a combination of both. In most cases, adding the following to the project root vite.config.js is enough to get started. It uses the recommended default configuration provided by this package.

import { setConfig } from '@imagexmedia/vite'

export default setConfig()

Basic mode

The first parameter in setConfig() accepts an object of options provided by this package.

Option: aliases

Define aliases used to replace values in import or require statements.

export default setConfig({
  aliases: {
    // @see https://vite.dev/config/shared-options#resolve-alias
    '@example': path.resolve(process.cwd(), 'src/example'),
  }
})

Option: plugins.image

An anonymous function to override the image optimizer base configuration. The config parameter is the mutable image optimizer base configuration object that can be modified and returned. By default, only .svg files are optimized. Using an svgo.config.js file is not supported, so make those changes in the config.svg object.

export default setConfig({
  plugins: {
    image: (config) => {
      // @see https://github.com/FatehAK/vite-plugin-image-optimizer
      config.exclude = /fa-.*\.svg$/i
      // @see https://svgo.dev/docs/plugins/
      config.svg.multipass = false

      return config
    },
  },
})

Advanced mode

The second parameter in setConfig() accepts an anonymous function that returns a Vite configuration object. The env parameter is for defining Conditional Config. The config parameter is the mutable Vite base configuration object that can be modified and returned.

export default setConfig({}, (env, config) => {
  if (env.mode === 'dev') {
    config.logLevel = 'info'
  }

  return config
})

Workspace overrides

By default, all workspaces use the project root vite.config.js file. By placing a vite.config.js file in the workspace, next to package.json, the workspace now uses its own separate configuration. The workspace can be configured in the same way as the project root or be something completely different.

[workspace_name]/
├── package.json
└── vite.config.js

Structure

The default configuration looks for entry points in two ways to allow some flexibility. First, it looks for valid entry points in the top-level workspace src/* folder. Second, it looks in the first-level subdirectories of the src/*/* folder. When it finds entry points in the top-level folder, it does not consider first-level subdirectories as containing additional entry points. Valid entry point file extensions include:

js ts jsx tsx cjs cts mjs mts css scss

Example 1 (recommended)

The recommended workspace structure for most components. Note that both example1.ts and example2.ts are treated as separate entry points with their own public/js/ output. The files in the scripts/ folder are not treated as entry points because they exist beyond the first-level subdirectory and must be imported in one of the entry points.

[workspace_name]/
├── public/
│   ├── css/
│   │   └── example.css
│   └── js/
│       ├── example1.js
│       └── example2.js
├── src/
│   ├── js/
│   │   ├── scripts/
│   │   │   └── extra.ts
│   │   ├── example1.ts (entry point)
│   │   └── example2.ts (entry point)
│   └── scss/
│       ├── scripts/
│       │   └── _extra.scss
│       └── example.scss (entry point)
└── package.json

Example 2 (simplified)

When a workspace includes only one or two files, the structure can be simplified. In this example, the SCSS file is treated as an entry point rather than having a second JavaScript file that imports the SCSS, which prevents the output from generating an empty JavaScript file just to compile CSS.

[workspace_name]/
├── public/
│   └── css/
│       └── example.css
├── src/
│   └── example.scss (entry point)
└── package.json

Example 3 (static assets)

The workspace static/ folder may contain additional static assets of any file type, and they will be copied directly into the public/ folder. Place them inside static/assets/ to have them copied to the public/assets/ folder. An SVG spritemap will auto-generate at public/assets/icons-sprite.svg when src/icons/ contains SVG files. SVGO optimizations are applied by default to any output SVG file, including the SVG spritemap and SVGs copied from the static/ folder.

[workspace_name]/
├── public/
│   ├── assets/
│   │   ├── example.svg
│   │   └── icons-sprite.svg
│   └── css/
│       └── example.css
├── src/
│   ├── icons/ (compiles to icons-sprite.svg)
│   │   ├── icon1.svg
│   │   └── icon2.svg
│   └── example.scss (entry point)
├── static/
│   └── assets/
│       └── example.svg
└── package.json

Additional resources

  • https://docs.npmjs.com/cli/v7/using-npm/workspaces
  • https://vite.dev/config/
  • https://rolldown.rs/reference/