mercredi 23 novembre 2016

Unwanted multiple passes thru broccoli-uglify-sourcemap

When I build my ember app, the uglify process seems to run 3x. I end up with the correct files in /dist (no duplicates) but I am trying to figure out what causes the multiple processing since it adds some 40+s to the entire build time. I am looking for help tracking down what causes this behavior. Any pointers/suggestions are appreciated! Below are the details from

  • build output
  • ember and npm version output
  • ember-cli-build.js
  • package.json dependencies

vagrant@web ~/sourcecode/ember-app (develop) $ DEBUG=broccoli-uglify* ember build -prod WARNING: WARNING: Node v6.1.0 has currently not been tested against Ember CLI and may result in unexpected behaviour. Could not start watchman; falling back to NodeWatcher for file system events. Visit http://ift.tt/22TlJJ7 for more info. ⠧ Building broccoli-uglify-sourcemap [starting]: assets/emberapp-new.js 3426.396KB +0ms broccoli-uglify-sourcemap [finsihed]: assets/emberapp-new.js 1972.914KB in 31858ms +32s [WARN] `assets/emberapp-new.js` took: 31858ms (more than 20,000ms) broccoli-uglify-sourcemap [starting]: assets/vendor.js 2919.476KB +186ms broccoli-uglify-sourcemap [finsihed]: assets/vendor.js 1055.143KB in 23658ms +24s [WARN] `assets/vendor.js` took: 23658ms (more than 20,000ms) broccoli-uglify-sourcemap [starting]: vendor/smart-app-banner/smart-app-banner-customized.js 18.722KB +81ms broccoli-uglify-sourcemap [finsihed]: vendor/smart-app-banner/smart-app-banner-customized.js 17.271KB in 195ms +195ms ⠧ Building broccoli-uglify-sourcemap [starting]: assets/emberapp-new.js 3426.396KB +5s broccoli-uglify-sourcemap [finsihed]: assets/emberapp-new.js 1972.914KB in 23366ms +23s [WARN] `assets/emberapp-new.js` took: 23366ms (more than 20,000ms) broccoli-uglify-sourcemap [starting]: assets/vendor.js 2919.476KB +299ms broccoli-uglify-sourcemap [finsihed]: assets/vendor.js 1055.143KB in 15446ms +15s broccoli-uglify-sourcemap [starting]: vendor/smart-app-banner/smart-app-banner-customized.js 18.722KB +56ms broccoli-uglify-sourcemap [finsihed]: vendor/smart-app-banner/smart-app-banner-customized.js 17.271KB in 144ms +144ms ⠏ Building broccoli-uglify-sourcemap [starting]: assets/emberapp-new.js 3426.396KB +6s broccoli-uglify-sourcemap [finsihed]: assets/emberapp-new.js 1972.914KB in 21768ms +22s [WARN] `assets/emberapp-new.js` took: 21768ms (more than 20,000ms) broccoli-uglify-sourcemap [starting]: assets/vendor.js 2919.476KB +73ms broccoli-uglify-sourcemap [finsihed]: assets/vendor.js 1055.143KB in 13516ms +14s broccoli-uglify-sourcemap [starting]: vendor/smart-app-banner/smart-app-banner-customized.js 18.722KB +46ms broccoli-uglify-sourcemap [finsihed]: vendor/smart-app-banner/smart-app-banner-customized.js 17.271KB in 118ms +118ms Built project successfully. Stored in "dist/". File sizes: - emberapp-new-386fe2160c8b66e54bf392d77ba05d77.js: 1.88 MB (237.26 KB gzipped) - emberapp-new-9b01fe5dd8aa1c1edd813ec6df1b770f.css: 228.16 KB (25.57 KB gzipped) - emberapp-new-blessed1-3993cdbb2f4c8271d7225ab60b2f499b.css: 441.35 KB (47.48 KB gzipped) - emberapp-new-blessed2-7ab46f5c0abdc702458f973a1104c1c6.css: 414.31 KB (38.13 KB gzipped) - emberapp-new.css: 1.07 MB (106.06 KB gzipped) - vendor-a88fcc2735e20663a1d61815d538e5be.js: 1.01 MB (260.19 KB gzipped) - vendor.css: 0 B - smart-app-banner-customized.js: 16.87 KB (6.3 KB gzipped) - smart-app-banner.css: 7.97 KB (1.64 KB gzipped)


Output from ember version --verbose && npm --version:

vagrant@web ~ $ ember version --verbose WARNING: WARNING: Node v6.1.0 has currently not been tested against Ember CLI and may result in unexpected behaviour. Could not start watchman; falling back to NodeWatcher for file system events. Visit http://ift.tt/22TlJJ7 for more info. ember-cli: 2.5.0 http_parser: 2.7.0 node: 6.1.0 v8: 5.0.71.35 uv: 1.9.0 zlib: 1.2.8 ares: 1.10.1-DEV icu: 56.1 modules: 48 openssl: 1.0.2h os: linux x64

vagrant@web ~ $ npm --version 3.8.6


ember-cli-build.js

var EmberApp = require('ember-cli/lib/broccoli/ember-app'),
bless = require('ember-cli-bless').blessCss,
postcss = require('broccoli-postcss'),
autoprefixer = require('autoprefixer'),
combineMq = require('broccoli-css-mqpacker'), // broccoli-combine-mq doesn't seem to work at this time (5/10/16)
mergeTrees = require('broccoli-merge-trees'),
funnel = require('broccoli-funnel'),
AssetRev = require('broccoli-asset-rev');

module.exports = function(defaults) {
// set options based on debug/test/prod env
var debug = EmberApp.env() === 'development',
    testing = EmberApp.env() === 'test',
    prod = !debug && !testing,
    sassOptions = debug ? { sourceMapEmbed: true } : { },
    autoprefixerEnabled = prod,
    postcssMap = debug ? { inline: true } : { },
    browsers = ["last 3 versions", "> 1%", "ie 8"],
    restOfApp,
    prefixed,
    revved;

// main ember app obj, will compile/minify css/js
var app = new EmberApp(defaults, {
        minifyCSS: {
            options: {
                processImport: false
            }
        },
  minifyJS: {
    enabled: true
  },
        bless: {
            enabled: false
        },
        fingerprint: {
            enabled: false
        },
        sassOptions: sassOptions,
        autoprefixer: {
            enabled: autoprefixerEnabled,
            browsers: browsers
        }
    });

var cssTree = funnel(app.toTree(), {
    include: ['assets/emberapp-new*.css']
});

if (debug) {
    prefixed = postcss(cssTree, {
        plugins: [{
            module: autoprefixer,
            options: {
                browsers: browsers
            }
        }],
        map: postcssMap
    });

    // get other dist files (besides main.css)
    restOfApp = funnel(app.toTree(), {
        exclude: ['assets/emberapp-new*.css']
    });
}

if (prod) {
    prefixed = cssTree;

    // get dist files we AREN'T messing with (this includes a copy of main.css)
    restOfApp = funnel(app.toTree(), {
        exclude: ['assets/**/*.js', 'index.html']
    });

    // combine media queries
    var combined = combineMq(prefixed, {
        files: ['*.css'],
        settings: {
            beautify: true
        }
    });

    // bless
    var blessed = bless(combined, {
        imports: true
    });

    // get all files we want to rev, plus index.html
    var blessedAndIndex = mergeTrees([
        funnel(app.toTree(), {
            include: ['index.html', 'assets/**/*.js', 'assets/**/.css']
        }),
        blessed
    ]);

    // asset rev
    revved = new AssetRev(blessedAndIndex, {
        extensions: ['css', 'js']
    });
}

app.import('bower_components/jquery/dist/jquery.min.js');
app.import('bower_components/moment/min/moment.min.js');
app.import('bower_components/moment-timezone/builds/moment-timezone-with-data.min.js');
app.import('vendor/modernizr.custom.98851.js');
app.import('vendor/jquery.cookie.js');
app.import('vendor/jquery.touchSwipe.min.js');
app.import('vendor/simplebar/simplebar.min.js');
app.import('vendor/jquery-plugins.js');

if (prod) { // prod
    return mergeTrees([restOfApp, revved], {
        overwrite: true
    });
} else if (testing) { // test
    return app.toTree();
} else { // development
    return mergeTrees([restOfApp, prefixed], {
        overwrite: true
    });
}
};


dependencies from package.json

"autoprefixer": "^6.3.6",
"bower": "^1.7.9",
"broccoli-asset-rev": "^2.4.2",
"broccoli-combine-mq": "^1.0.3",
"broccoli-css-mqpacker": "^0.2.1",
"broccoli-funnel": "^1.0.1",
"broccoli-merge-trees": "^1.1.1",
"broccoli-postcss": "^3.0.0",
"ember-ajax": "0.7.1",
"ember-cli": "^2.5.0",
"ember-cli-app-version": "^1.0.0",
"ember-cli-autoprefixer": "0.6.0",
"ember-cli-babel": "^5.1.6",
"ember-cli-bless": "0.1.1",
"ember-cli-dependency-checker": "^1.2.0",
"ember-cli-htmlbars": "^1.0.3",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-inject-live-reload": "^1.4.0",
"ember-cli-jshint": "^1.0.0",
"ember-cli-qunit": "^1.4.0",
"ember-cli-release": "0.2.8",
"ember-cli-sass": "5.3.1",
"ember-cli-uglify": "^1.2.0",
"ember-data": "^2.5.0",
"ember-export-application-global": "^1.0.5",
"ember-load-initializers": "^0.5.1",
"ember-resolver": "^2.0.3",
"loader.js": "^4.0.1"




Aucun commentaire:

Enregistrer un commentaire