diff --git a/src/combine.js b/src/combine.js index 12d0a7a..6287302 100644 --- a/src/combine.js +++ b/src/combine.js @@ -57,6 +57,7 @@ module.exports.folder = async (root, options) => { if(typeof options.vars !== 'object' || options.vars === null) break; + const bvTarget = args.shift(); const bvSourceName = trimEnd(args.join(' '), ';'); const bvSource = options.vars[bvSourceName]; if(typeof bvSource !== 'objects' || bvSource === null) @@ -67,7 +68,7 @@ module.exports.folder = async (root, options) => { bvProps.push(`${bvName}: { value: ${JSON.stringify(bvSource[bvName])} }`); if(Object.keys(bvProps).length > 0) - output += `Object.defineProperties(${options.varsTarget}, { ${bvProps.join(', ')} });\n`; + output += `Object.defineProperties(${bvTarget}, { ${bvProps.join(', ')} });\n`; break; default: diff --git a/src/handlers/js.js b/src/handlers/js.js index 8f2d29d..adbda4b 100644 --- a/src/handlers/js.js +++ b/src/handlers/js.js @@ -7,7 +7,6 @@ const { strtr, shortHash, writeFile } = require('../utils.js'); module.exports = function(env) { const PREFIX = '#'; const DEFAULT_ENTRY = 'main.js'; - const DEFAULT_VARS_TARGET = 'window'; const createJscOpts = () => { return { @@ -50,7 +49,6 @@ module.exports = function(env) { prefix: PREFIX, entry: task.entry ?? DEFAULT_ENTRY, vars: vars, - varsTarget: task.varsTarget ?? DEFAULT_VARS_TARGET, }), { filename: task.source, sourceMaps: false,