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

@intility/vite-plugin-msal

v0.4.0

Published

Vite plugin for msal-browser

Readme

@intility/vite-plugin-msal

Vite plugin for @azure/msal-browser features.

Usage

First, install the package:

npm install @intility/vite-plugin-msal

Then, set up the plugin in your vite.config.ts:

import msal from "@intility/vite-plugin-msal";
import { defineConfig } from "vite";

// https://vite.dev/config/
export default defineConfig({
  plugins: [msal()],
});

Features

Redirect Bridge

This plugin automatically emits a redirect bridge described in Login User / RedirectUri Considerations and the v4 -> v5 Migration guide, which is bundled with vite and your installed version of @azure/msal-browser.

The path of the redirect page can be configured with redirectBridgePath:

msal({
  redirectBridgePath: "/auth/redirect"
})

[!IMPORTANT] If you haven't had a redirect bridge earlier, remember to update your redirect URIs in Entra ID.

Cross-Origin-Opener-Policy header

The COOP header is returned by the authentication service and requires the application to have a redirect bridge (which this plugin provides). You do not need to serve the COOP header yourself, but if you choose to, configure coopHeader and the plugin will add it to all pages except the redirect bridge during dev/preview.

msal({
  coopHeader: "same-origin"
})

[!IMPORTANT] The plugin can only configure this for the dev and preview server. It is your responsibility to ensure your deployments return the header correctly in production.

Bypass metadata resolution

This plugin can optionally pre-fetch cloud discovery and OpenID metadata at build time, described in the msal-common Performance docs.

[!NOTE] This is not needed when using the standard login.microsoftonline.com authority — MSAL already includes hardcoded metadata for it. This option exists as an escape hatch for applications using a non-standard authority where MSAL cannot resolve metadata on its own. See MSAL issue #8392 for context.

Configure the authority option in the plugin to fetch metadata at build time:

msal({
  authority: "https://login.example.com/tenant-id"
})

Then use withMetadata to apply the pre-fetched metadata to your MSAL config:

import { withMetadata } from "@intility/vite-plugin-msal/client";
import { PublicClientApplication } from "@azure/msal-browser";

const msalConfig = withMetadata({
  auth: {
    clientId: "your-client-id",
  },
});

const instance = new PublicClientApplication(msalConfig);

If auth.authority is not set in your MSAL config, the plugin's configured authority will be applied automatically. If it is set, it must match the authority passed to the plugin.