lundi 30 mai 2016

Compile Ember CLI project assets to multiple JS files

I've got a project with a need for multiple JS files. Some use cases:

  • IE-only polyfills I include with a conditional comment and don't want mobile devices to download
  • Large files not included on a landing page that I want to lazy load

It appears that ember cli allows for multiple CSS files, but not multiple JS files:

venter code herear app = new EmberApp({
  outputPaths: {
    app: {
      js: {
        app: '/assets/app.js',
        ie: '/assets/ie.js'
      }
    }
  }
});

Errors:

Object #<Object> has no method 'slice'
TypeError: Object #<Object> has no method 'slice'
    at module.exports (/Users/<me>/Projects/<my-app>/node_modules/ember-cli/node_modules/broccoli-sourcemap-concat/index.js:15:30)
    at EmberApp.concatFiles (/Users/<me>/Projects/<my-app>/node_modules/ember-cli/lib/broccoli/ember-app.js:261:10)
    at EmberApp.javascript (/Users/<me>/Projects/<my-app>/node_modules/ember-cli/lib/broccoli/ember-app.js:864:16)
    at EmberApp.toArray (/Users/<me>/Projects/<my-app>/node_modules/ember-cli/lib/broccoli/ember-app.js:1159:10)
    at EmberApp.toTree (/Users/<me>/Projects/<my-app>/node_modules/ember-cli/lib/broccoli/ember-app.js:1181:30)
    at Object.<anonymous> (/Users/<me>/Projects/<my-app>/Brocfile.js:35:22)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

There's nothing in the guides about multiple JS files other than vendor; is there something I'm missing or is this a missing feature?




Aucun commentaire:

Enregistrer un commentaire