vite-plugin-cdn-import
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -242,14 +242,25 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __defProp = Object.defineProperty; | ||
}); | ||
const externalLibs = Object.keys(externalMap); | ||
const plugins = [ | ||
{ | ||
name: "vite-plugin-cdn-import", | ||
config(config, {command}) { | ||
config(_, {command}) { | ||
const userConfig = { | ||
build: { | ||
rollupOptions: {} | ||
} | ||
}; | ||
if (command === "build") { | ||
isBuild = true; | ||
userConfig.build.rollupOptions = { | ||
external: [...externalLibs], | ||
plugins: [_rolluppluginexternalglobals2.default.call(void 0, externalMap)] | ||
}; | ||
} else { | ||
isBuild = false; | ||
} | ||
return userConfig; | ||
}, | ||
transformIndexHtml(html) { | ||
const cssCode = data.map((v) => v.cssList.map((css) => `<link href="${css}" rel="stylesheet">`).join("\n")).filter((v) => v).join("\n"); | ||
const cssCode = !isBuild ? "" : data.map((v) => v.cssList.map((css) => `<link href="${css}" rel="stylesheet">`).join("\n")).filter((v) => v).join("\n"); | ||
const jsCode = !isBuild ? "" : data.map((p) => p.pathList.map((url) => `<script src="${url}"></script>`).join("\n")).join("\n"); | ||
@@ -261,5 +272,2 @@ return html.replace(/<\/title>/i, `</title>${cssCode} | ||
]; | ||
if (isBuild) { | ||
plugins.push(_rolluppluginexternalglobals2.default.call(void 0, externalMap)); | ||
} | ||
return plugins; | ||
@@ -266,0 +274,0 @@ } |
{ | ||
"name": "vite-plugin-cdn-import", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "Import packages from CDN for the vite plugin", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27547
683