$ yarn add vite-plugin-cdn2 -D # or $ npm install vite-plugin-cdn2 -D Usage // vite.config.ts import { defineConfig } from "vite"; import { cdn } from "vite-plugin-cdn2"; export default defineConfig({ plugins: [ // ... your plugin cdn({ modules: ["vue"] }), ], })...
cdn({ modules: [{ name: "vue", relativeModule: "vue.global.prod.min.js" }, "vue-router", "vue-demi", "pinia", "axios" ], resolve: defineResolve({ name: "resolve:custom", setup({ extra }) { const baseURL = "https://cdn.staticfile.net/"; c...
function transformPresetModule(api: ExternalPluginAPI): Plugin { return { name: 'vite-plugin-cdn2:presetModule', transform(code, id) { if (!api.filter(id)) return if (id.includes(NODE_MODULES)) { const result = transformCJSRequire(code, api.dependency.dependency)...
在vite5.1.5 中使用 vite-plugin-cdn2 v0.15.4 构建 echarts 提示:echarts try resolve file failed。但是,其他的包都正常构建。环境macOS:14.3.1 (23D60) cpu:m3 max vite:5.1.5配置截图resolve 方法,是一个将 cdnjs 资源地址拼接完整的方法,不过,当我手动补全的时候,也是无效的。XiaoDaiGua-Ray changed...
Add it to vite.config.js // vite.config.jsimportcdnfrom'vite-plugin-cdn-import'exportdefault{plugins:[cdn({modules:[{name:'react',var:'React',path:`umd/react.production.min.js`,},{name:'react-dom',var:'ReactDOM',path:`umd/react-dom.production.min.js`,},],}),],} ...
importimportFromCDNfrom"vite-plugin-cdn-import-rely";exportdefaultdefineConfig({plugins:[importFromCDN([{name:"element-plus",var:"ElementPlus",path:"index.full.min.js",relys:["vue"],},{name:"element-plus/es/locale/lang/zh-cn",pkgName:"element-plus",var:"ElementPlusLocaleZhCn",path:"loca...
一个支持运行时 CDN 配置的 Vite 插件。 Install Make sure your vite version is2.9.0or higher. #pnpmpnpm add -D vite-plugin-runtime-cdn#yarnyarn add -D vite-plugin-runtime-cdn#npmnpm i -D vite-plugin-runtime-cdn Usage // vite.config.jsimport{defineConfig}from'vite'// 1. import the...
vite-plugin-cdn-link 将项目中打包后生产文件替换静态资源地址为cdn地址 功能特性 几乎零配置,使用viteoutDir路径,替换里面的资源地址为cdn地址 安装 适用vite 5 的 ESM 版本: npm i -D vite-plugin-cdn-link@latest 基本使用 在vite.config.js 中注册本插件 ...
A vite plugin make import rely from CDN easier Version3.1.0LicenseMIT INSTALL Type:ESMDefault Version: import vitePluginCdnImportRely from'https://cdn.jsdelivr.net/npm/vite-plugin-cdn-import-rely@3.1.0/+esm' Learn more Statistics Requests19 Bandwidth...
// vite.config.tsimport{defineConfig}from'vite'import{cdn}from'vite-plugin-cdn2'exportdefaultdefineConfig({plugins:[// ... your plugincdn({isProduction:true,modules:[{name:'vue',global:'Vue'}]})]}) exporttypePresetDomain='auto'|'jsdelivr'|'unpkg'|falseexportinterfaceCDNPluginOptions{isPro...