glimmerjs / glimmer-application-pipeline

Tooling for developing Glimmer standalone apps with ember-cli
MIT License
21 stars 31 forks source link

app.import is not a function #41

Open michalsnik opened 7 years ago

michalsnik commented 7 years ago

Hey, I was playing with Glimmer today and found out that it's application pipeline doesn't have import method, but in the generated blueprint there is information that it should be there:

// Use `app.import` to add additional libraries to the generated
// output files.

When trying to import any additional resources I'm getting app.import is not a function. I think it would be really good to have this in glimmer pipeline as well.

dgeb commented 7 years ago

We agree and will be implementing this very soon! Sorry for the doc mismatch.

voltidev commented 7 years ago

I'm sure the workaround below is not a good way to do it, and yes I'm using private API here, but it works for me at the moment (it will also fingerprint vendor.js for production as you expect) :

$ npm install --save-dev broccoli-concat broccoli-merge-trees

ember-cli-build.js:

'use strict';

const GlimmerApp = require('@glimmer/application-pipeline').GlimmerApp;
const Concat = require('broccoli-concat');
const MergeTrees = require('broccoli-merge-trees');

class CustomApp extends GlimmerApp {
  publicTree() {
    let originalTree = super.publicTree();

    let vendorScripts = new Concat('node_modules', {
      inputFiles: [
        'core-js/client/core.min.js',
        'whatwg-fetch/fetch.js'
      ],
      outputFile: 'vendor.js',
    });

    return new MergeTrees([originalTree, vendorScripts], { overwrite: true });
  }
}

module.exports = function(defaults) {
  let app = new CustomApp(defaults, {
    fingerprint: {
      exclude: ['apple-touch-icon', 'favicon', 'mstile', 'android-chrome']
    }
  });

  return app.toTree();
};
jamesarosen commented 6 years ago

I've started work on this here. It's far from complete at this point.

charlesfonlupt commented 6 years ago

Hey. I am playing with Glimmer today. I was trying to import bootstrap-sassy, but the ember app crash.

After trying to reinitiate the server I receive that message :

app.import is not yet implemented for GlimmerApp

Any solution or work around ?

rwjblue commented 6 years ago

@jamesarosen - Have you had a chance to make any progress?

Mike-Neto commented 5 years ago

Any news on this, I'd like to take advantage of most ember addons inside glimmer apps.

I could help in getting this done, however I'd need some guidance on what to do.

Argun commented 4 years ago

Still not implemented import function, is there any solution?