Vite plugin that use '.js' extension for the UMD format
npm install vite-plugin-resolve-umd-formatVite plugin that use .js extension for the UMD format.
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.
You can install this plugin using your preferred package manager:
``bashWith npm
npm i -D vite-plugin-resolve-umd-format
Usage
To use the plugin, simply import it and add it to the plugins array in your Vite config file:
`js
// vite.config.js
import umdFormatResolver from 'vite-plugin-resolve-umd-format'export default {
plugins: [umdFormatResolver()]
}
``A project by Stilearning © 2023.