vite-plugin-import-cdn-fault-tolerant
v0.1.2
Published
vite插件 引入cdn的包时,可配置容错路径/、本地路径
Downloads
21
Readme
import { defineConfig } from "vite";
import VitePluginImportCdnFaultTolerant from "vite-plugin-import-cdn-fault-tolerant";
export default defineConfig({
plugins: [
VitePluginImportCdnFaultTolerant({
modules: [
{
name: "vue",
var: "Vue",
pathList: [
{
path: `https://cdn.bootcdn.net/ajax/libs/vue/3.3.4/vue.global.prod.min.js`,
alternatePath: "./libs/vue.global.prod.min.js",
},
],
},
{
name: "vue-router",
var: "VueRouter",
pathList: [
{
path: `https://cdn.staticfile.org/element-plus/2.3.12/index.full.min.js`,
alternatePath: "./libs/element-plus/index.full.min.js",
},
{
tag: "link",
attrs: {},
path: `//cdn.jsdelivr.net/npm/element-plus/dist/index.css`,
alternatePath: "./libs/element-plus/index.css",
},
],
},
],
}),
],
});