8000 fix: Global keys order is respected in config, fixes #1304 (#1305) · fuse-box/fuse-box@722c501 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit 722c501

Browse files
Josh Pikenchanged
authored andcommitted
fix: Global keys order is respected in config, fixes #1304 (#1305)
* fix: Global keys order is respected is config * fix: truthy check bad idea for checking that an integer value exists * fix: fixed globalvariable test regressions
1 parent f680f49 commit 722c501

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/quantum/plugin/QuantumCore.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,17 +254,27 @@ export class QuantumCore {
254254
public render() {
255255
return each(this.producerAbstraction.bundleAbstractions, (bundleAbstraction: BundleAbstraction​​) => {
256256
const globals = this.producer.fuse.context.globals;
257+
const globalFileMap = {};
257258
const generator = new FlatFileGenerator(this, bundleAbstraction);
258259
generator.init();
259260
return each(bundleAbstraction.packageAbstractions, (packageAbstraction: PackageAbstraction) => {
260261
return each(packageAbstraction.fileAbstractions, (fileAbstraction: FileAbstraction) => {
261262
if (fileAbstraction.fuseBoxPath == packageAbstraction.entryFile && globals && Object.keys(globals).indexOf(packageAbstraction.name) != -1) {
262-
generator.setGlobals(globals[packageAbstraction.name], fileAbstraction.getID());
263+
globalFileMap[packageAbstraction.name] = fileAbstraction.getID();
263264
}
264265
return generator.addFile(fileAbstraction, this.opts.shouldEnsureES5());
265266
});
266267

267268
}).then(() => {
269+
270+
if(globals){
271+
Object.keys(globals).forEach(globalPackageName => {
272+
if(globalFileMap[globalPackageName] !== undefined) {
273+
generator.setGlobals(globals[globalPackageName], globalFileMap[globalPackageName]);
274+
}
275+
})
276+
}
277+
268278
this.log.echoInfo(`Render bundle ${bundleAbstraction.name}`);
269279
const bundleCode = generator.render();
270280
this.producer.bundles.get(bundleAbstraction.name).generatedCode = new Buffer(bundleCode);

0 commit comments

Comments
 (0)
0