From 12cbd31f8a4988fe9a4f7438575974c6e6d7c090 Mon Sep 17 00:00:00 2001 From: cap-Bernardito Date: Mon, 12 Jul 2021 17:13:09 +0300 Subject: [PATCH] refactor: code --- 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()