From 21c80c8c2f2ca751124f26f5984195e20f2ac665 Mon Sep 17 00:00:00 2001 From: Alexey Lavinsky Date: Mon, 12 Jul 2021 07:23:54 -0700 Subject: [PATCH] fix: reduce runtime when you use custom options (#520) --- src/index.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/index.js b/src/index.js index 6f1a7949..373986b6 100644 --- a/src/index.js +++ b/src/index.js @@ -31,12 +31,15 @@ loaderAPI.pitch = function loader(request) { const { styleTagTransform } = options; const esModule = typeof options.esModule !== "undefined" ? options.esModule : true; - const runtimeOptions = { - injectType: options.injectType, - attributes: options.attributes, - insert: options.insert, - base: options.base, - }; + const runtimeOptions = {}; + + if (options.attributes) { + runtimeOptions.attributes = options.attributes; + } + + if (options.base) { + runtimeOptions.base = options.base; + } const insertFn = insertIsFunction ? options.insert.toString()