diff --git a/dist/index.d.ts b/dist/index.d.ts index 573941c..9b7eb15 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,7 +1,13 @@ import { Plugin } from 'vite'; interface PreloadOptions { + /** + * @default true + */ includeJs: boolean; + /** + * @default true + */ includeCss: boolean; isPrefetch: boolean; prettierSettings: any; diff --git a/dist/index.js b/dist/index.js index 3699fe8..decdec2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => { return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); @@ -79,8 +83,8 @@ var appendToDom = (dom, link) => dom.window.document.head.appendChild(link); // src/index.ts var import_prettier = __toESM(require("prettier")); -var jsFilter = (0, import_pluginutils.createFilter)(["**/*.*.js"]); -var cssFilter = (0, import_pluginutils.createFilter)(["**/*.*.css"]); +var jsFilter = (0, import_pluginutils.createFilter)(["**/*-*.js"]); +var cssFilter = (0, import_pluginutils.createFilter)(["**/*-*.css"]); function VitePluginPreloadAll(options) { let viteConfig; const mergedOptions = { ...defaultOptions, ...options }; @@ -97,6 +101,7 @@ function VitePluginPreloadAll(options) { if (!ctx.bundle) { return html; } + const base = viteConfig.base ?? ""; const dom = createDom(html); const existingLinks = getExistingLinks(dom); let additionalModules = []; @@ -147,5 +152,3 @@ function VitePluginPreloadAll(options) { } }; } -// Annotate the CommonJS export names for ESM import in node: -0 && (module.exports = {}); diff --git a/dist/index.mjs b/dist/index.mjs index f4b83b9..87aeb5e 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -47,8 +47,8 @@ var appendToDom = (dom, link) => dom.window.document.head.appendChild(link); // src/index.ts import prettier from "prettier"; -var jsFilter = createFilter(["**/*.*.js"]); -var cssFilter = createFilter(["**/*.*.css"]); +var jsFilter = createFilter(["**/*-*.js"]); +var cssFilter = createFilter(["**/*-*.css"]); function VitePluginPreloadAll(options) { let viteConfig; const mergedOptions = { ...defaultOptions, ...options }; @@ -65,6 +65,7 @@ function VitePluginPreloadAll(options) { if (!ctx.bundle) { return html; } + const base = viteConfig.base ?? ""; const dom = createDom(html); const existingLinks = getExistingLinks(dom); let additionalModules = [];