vite-plugin-router-warn

raw JSON →
2.0.0 verified Mon Apr 27 auth: no javascript

A Vite plugin that suppresses the 'No match found for location with path' warning from vue-router during development. Version 2.0.0 is stable, with infrequent updates. It works by patching vue-router's internal warning suppressor to silence that specific warning when routes are dynamically added or refreshed. Only active in development mode, processes only vue-router files, and runs once at startup. Provides optional export of modified router file for debugging. Designed as a temporary fix until vue-router provides native support to disable the warning.

error Cannot find module 'vite-plugin-router-warn'
cause The package is not installed or is missing from node_modules.
fix
Run npm install vite-plugin-router-warn -D or yarn add vite-plugin-router-warn -D
error SyntaxError: Named export 'removeNoMatch' not found. The requested module 'vite-plugin-router-warn' is a CommonJS module, which may not support all module.exports as named exports.
cause Using named import instead of default import.
fix
Change to import removeNoMatch from 'vite-plugin-router-warn'
error TypeError: removeNoMatch is not a function
cause Using the plugin with `plugins: [vue(), removeNoMatch]` instead of `plugins: [vue(), removeNoMatch()]`.
fix
Invoke the plugin as a function: removeNoMatch()
gotcha The plugin only works in development mode. In production builds, the warning is not suppressed.
fix No action needed; this is by design. The warning does not appear in production because vue-router does not show it in production builds.
gotcha The plugin modifies vue-router's internal module at runtime, which could break with vue-router updates.
fix Check compatibility when upgrading vue-router. The plugin may need an update if vue-router internals change.
deprecated If vue-router provides official configuration to suppress the warning, this plugin will become obsolete.
fix Monitor vue-router changelog for 'suppressNoMatchWarning' or similar option. Then remove this plugin.
gotcha The plugin runs only once at startup. Dynamic routes added later still triggered the warning until patched; the plugin may not cover all cases.
fix Ensure route additions happen before the initial page load, or reload the page after adding routes.
npm install vite-plugin-router-warn
yarn add vite-plugin-router-warn
pnpm add vite-plugin-router-warn

Demonstrates how to install and configure the plugin in a Vite project to suppress vue-router warnings.

// vite.config.ts
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import removeNoMatch from 'vite-plugin-router-warn';

export default defineConfig({
  plugins: [vue(), removeNoMatch()]
});