Skip to content

Commit

Permalink
Updated vendor scripts to use entire sandbow instead of just window.
Browse files Browse the repository at this point in the history
  • Loading branch information
Haddix, Steven authored and Haddix, Steven committed Oct 27, 2016
1 parent 1bf2cf9 commit 963e197
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions index.js
Expand Up @@ -94,6 +94,10 @@ function merge (a, b) {
return a
}

/*
* Function to handle commonschunk plugin. Currently only supports a manifest file and single external
* library file name vendor.
*/
var loadChunkAssetsToScope = function(scope, compilation, webpackStatsJson) {
var manifest = findAsset('manifest', compilation, webpackStatsJson);
var vendor = findAsset('vendor', compilation, webpackStatsJson);
Expand All @@ -102,19 +106,20 @@ var loadChunkAssetsToScope = function(scope, compilation, webpackStatsJson) {
return scope;
}

//var manifestRender = evaluate(manifest.source(), 'manifest', self.scope, true);
if (!scope.window) {
scope.window = {};
}

var sandbox = {};

merge(sandbox, scope);

var manifestScript = new vm.Script(manifest.source());
var manifestRender = manifestScript.runInNewContext(sandbox, {});
manifestScript.runInNewContext(sandbox, {});

merge(sandbox, sandbox.window)

var vendorScript = new vm.Script(vendor.source());
var vendorRender = vendorScript.runInNewContext(sandbox.window, {});
vendorScript.runInNewContext(sandbox, {});

return sandbox.window;
}
Expand Down

0 comments on commit 963e197

Please sign in to comment.