Vars target from #vars decl.
This commit is contained in:
parent
47bd2fab87
commit
b07c088ab7
2 changed files with 2 additions and 3 deletions
|
@ -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:
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue