nonzzz / vite-plugin-cdn

replace module with CDN. work with vite.
MIT License
75 stars 6 forks source link

希望优先使用用户自定义配置 #22

Closed jian-jiu closed 1 year ago

jian-jiu commented 1 year ago

在获取x的时候 x = b || p || i; i在前面优先使用用户配置的relativeModule

  let { name: s, relativeModule: i, aliases: a, ...n } = r;
  try {
    let o = W.resolve(s), c = k(o, "package.json"), u = await F.readFile(c, "utf8"), f = JSON.parse(u), {
      version: d,
      name: l,
      unpkg: p,
      jsdelivr: b
    } = f, g = Object.create(null), x = b || p || i;
    if (!x) throw new Error("try resolve file failed.");
}
nonzzz commented 1 year ago

这确实应该relativeModule 优先。有些库例如vue 的默认 jsdelivr就是用的dev

nonzzz commented 1 year ago

0.12.3 已经采用relativeModule 优先