Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

When doing SFX build with globalDeps, the output files are not deterministic #515

Closed
mikeyoon opened this issue Mar 3, 2016 · 3 comments

Comments

@mikeyoon
Copy link

mikeyoon commented Mar 3, 2016

I noticed when doing an SFX build where I want to exclude certain dependencies, I need to use the globalDeps option to inject them. The order in which those dependencies are injected seem to be non-deterministic due to some object to array conversions.

Here's an example gulp except of what I'm doing.

var appVendorExclude = [
  'angular',
  'angular-ui-router',
  'angular-sanitize',
  'lodash',
  'jquery'
];

builder.buildStatic('src/core-app/bootstrap.ts - ' + appVendorExclude.join(' - '), './build/app.js', {mangle: prod, minify: prod, sourceMaps: false,
    globalDeps: {
      angular: 'angular',
      "angular-sanitize": "angular",
      "angular-ui-router": "angular",
      jquery: '$',
      lodash: '_'
    }
  });

So output can end up like this:

< (["5a","5a"], ["3","18","c","37"], function($__System) {

---
> (["5a","5a"], ["3","18","37","c"], function($__System) {
62714c62714
<     define(["jquery","lodash","angular","angular-sanitize"], factory);

---
>     define(["jquery","lodash","angular-sanitize","angular"], factory);
62717c62717
<     module.exports = factory(require("jquery"), require("lodash"), require("angular"), require("angular-sanitize"));

---
>     module.exports = factory(require("jquery"), require("lodash"), require("angular-sanitize"), require("angular"));

I have a simple fix in mind I will make a PR for.

@guybedford
Copy link
Member

👍

@guybedford
Copy link
Member

Fixed in 08f69b9.

@guybedford
Copy link
Member

Released in 0.15.11.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants