Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

vite-plugin-resolve-umd-format

bent10780MIT1.0.0TypeScript support: included

Vite plugin that use '.js' extension for the UMD format

vite, vite-plugin, umd

readme

vite-plugin-resolve-umd-format

Vite plugin that use .js extension for the UMD format.

Why?

Since Vite v3, UMD modules are resolved with the .cjs extension by default (for CommonJS, indicating a Node module), which causes it to be served with the Content-Type header “application/node”. We need to rename it to .js so that it gets served with the correct MIME type.

Install

You can install this plugin using your preferred package manager:

# With npm
npm i -D vite-plugin-resolve-umd-format

# With yarn
yarn add vite-plugin-resolve-umd-format --dev

Usage

To use the plugin, simply import it and add it to the plugins array in your Vite config file:

// vite.config.js
import umdFormatResolver from 'vite-plugin-resolve-umd-format'

export default {
  plugins: [umdFormatResolver()]
}

License

GitHub

A project by Stilearning © 2023.

changelog

vite-plugin-resolve-umd-format 1.0.0 (2023-10-26)

Features

  • init vite-plugin-resolve-umd-format (4a71e93)