Skip to content

CDN and Minification ​

CDN Utilities ​

ts
import { defineConfig } from 'vite';
import monkey, { cdn } from 'vite-plugin-monkey';
export default defineConfig({
  plugins: [
    monkey({
      build: {
        externalGlobals: {
          react: cdn.jsdelivr('React', 'umd/react.production.min.js'),
        },
        externalResource: {
          'element-plus/dist/index.css': cdn.jsdelivr(),
        },
      },
    }),
  ],
});

there is the following cdn to use, full detail see cdn.ts

if you want use other cdn, you can see external-scripts

Minification ​

because of the code-rules of greasyfork

Code posted to Greasy Fork must not be obfuscated or minified

so plugin will change the default value of viteConfig.build.minify to false

if you want to enable minify, just set viteConfig.build.minify=true