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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vite-plugin-tsconfig

v1.0.5

Published

Vite plugin that allows you to use alternate tsconfig files.

Downloads

1,374

Readme

MIT Version CI PRs Welcome

vite-plugin-tsconfig

yarn add -D vite-plugin-tsconfig

Vite plugin to that allows you to specify an alternate tsconfig filename.

import { defineConfig } from 'vite'
import tsconfig from 'vite-plugin-tsconfig'

export default defineConfig({
  plugins: [
    tsconfig({
      filename: 'tsconfig.build.json',

      // optional
      logLevel: 'info',

      // optional
      workspaces: ['packages/ui', 'packages/notifications'],
    }),
  ],
})

Features

  • allows a default tsconfig.json, in the end it will be put back in place
  • allows specifying workspaces for monorepo packages to be swapped at the same time as the root

Why?

As of 7/26/2023, vite does not allow users to specify alternate tsconfig files. Given a variety of needs including different development vs CI environments, it is common to use different tsconfig files to meet such needs.

Preferably, this plugin should become obsolete if vite includes the option to specify an alternate tsconfig.

How does it work?

It's a total hack. In the config stage, if a current tsconfig.json exists, it will back it up. Once that is complete, it will write the content from the provided alternate tsconfig file to the default filename of tsconfig.json. When the build is finishing, it will remove the generated file and replace the original (if one existed).

workspaces - why?

In monorepos, and specifically as we have seen with storybook usage and local tsconfig paths usage in development but not production, vite will try and loadTsconfigJsonForFile, which resolves as the package's tsconfig.json regardless of what the root level tsconfig.json specifies. This means that if your development configurations contain anythin incompatible with your CI/production configurations, vite is going to break. We added the workspaces property to allow this same file-swapping hack to operate in the workspace packages. We specifically did not try and read the root's package.json workspaces property because it may contain other packages that are irrelevant or that you do not want to provide the additional tsconfig filename to swap.

Contributing

PRs are accepted! This project is configured with auto, so feel free to submit a PR and auto will automatically create a canary release for you to try out.