Vite plugin that forces UMD format output to use .js extension instead of .cjs, fixing Content-Type header issues. Current version 1.0.0, compatible with Vite >=4.0.0. Addresses a specific Vite v3+ behavior where UMD modules get .cjs extension and 'application/node' MIME type; this plugin renames output to .js for correct browser consumption. Differentiates from generic output manipulation by targeting UMD format only and being lightweight. Ships TypeScript types.
npm install vite-plugin-resolve-umd-formatVerified import paths — ran on the pinned version, not inferred.
Shows basic usage: import the default export, add to plugins array, and configure UMD output.
Ensure build output format is set to 'umd' for plugin to take effect.
Monitor Vite changelogs; if native option is added, consider removing plugin.
Upgrade Vite to version 4 or later, or use an alternative workaround.
Use default import: import umdFormatResolver from 'vite-plugin-resolve-umd-format'
Change to: import umdFormatResolver from 'vite-plugin-resolve-umd-format'
Use import syntax or set "type": "module" in package.json.
Run: npm install vite-plugin-resolve-umd-format --save-dev
Set build.rollupOptions.output.format to 'umd'.