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

@bithero/monaco-editor-vite-plugin

v1.0.2

Published

Vite plugin to include & bundle monaco-editor

Readme

monaco-editor-vite-plugin

Npm package version Npm package version Npm package types

A vite plugin to ease bundeling of the monaco editor.

License

This project is licensed under AGPL-3.0-or-later. See the LICENSE file for more informations.

Usage

import { monaco } from '@bithero/monaco-editor-vite-plugin';

export default defineConfig({
    plugins: [
        monaco({
            features: "all",
            languages: ["json"],
            globalAPI: true,
        }),
    ],
});

Note: in order to work correctly, the plugin needs to exclude 'monaco-editor' from vite's dependency optimization. It does this by adding it to optimizeDeps.exclude, and will remove any possible entry from optimizeDeps.include.

feature configuration

The features option enables you to enable / disable certain features of monaco.

If the key is not present, the default features of monaco are used, which is equivalent with all being activated (or a value of * / all).

When a value of * or all is set, all features are activated.

Otherwise, it is an array of either inclusions or exclusions:

  • A exclusion is the featurename with a ! prepended (like !contextmenu). If any exclusion is present, from the set of all features, the excluded ones are removed. Inclusion rules are effectivly ignored then.

  • Otherwise a inclusion by just the featurename. This will only enable the features that are listed.

Note: If using a inclusion list, codicons are not loaded by default (if not requested by any other feature). So if you'll use them inside your html, make sure to add 'codicons' to your feature list!

languages configuration

By default, the monaco editor comes with a set of languages (discoverable by looking into the node_modules/monaco-editor/esm/vs/basic-languages and node_modules/monaco-editor/esm/vs/language folders), that might be a overhead for your usecase. Because of this, by default no languages are included.

To change this, you can set the languages option:

  • If set to either * or all, the default monaco behaviour is restored, by including every language.

  • Otherwise it's a list of the language-names that should be available.

custom languages

If you have an custom language, you can let it load too by using the customLanguages option. This option is an array of languages to be included, and needs to have the same format as the languages-metadata of core monaco (see node_modules/monaco-editor/esm/metadata.js).

export interface IWorkerDefinition {
	id: string;
	entry: string;
}

export interface IFeatureDefinition {
	label: string;
	entry: string | string[] | undefined;
	worker?: IWorkerDefinition;
}

Example:

monaco({
    customLanguages: [
        {
            label: 'my-lang',
            entry: 'some/path/to/my-lang',
        }
    ]
})

Both entry properties (once in IFeatureDefinition and once in IWorkerDefinition) are resolved with import.meta.resolve, which means that you can write paths as if you would write an import declaration in js/ts.

Additionally, the resolving is first tried with the prefix monaco-editor/esm, so you can easily extend & customize monaco's builtin languages.

globalAPI

With the globalAPI flag, one can simply set the self.MonacoEnvironment.globalAPI setting.