Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

ngc Task doesn't run when using ionic-app-scripts ngc #549

Closed
bildonia opened this issue Dec 14, 2016 · 3 comments
Closed

ngc Task doesn't run when using ionic-app-scripts ngc #549

bildonia opened this issue Dec 14, 2016 · 3 comments
Assignees

Comments

@bildonia
Copy link

Short description of the problem:

Running ionic-app-scripts ngc directly fails.
Output:

> ionic-app-scripts ngc

[10:25:21]  ionic-app-scripts 0.0.47
[10:25:21]  ngc started ...
[10:25:21]  ionic-app-script task: "ngc"
[10:25:21]  TypeError: Cannot read property 'fileCache' of undefined

What behavior are you expecting?

I expected to run ngc independent from the ionic-app-scripts build command. Here is output fro 0.0.45

> ionic-app-scripts ngc

[10:27:08]  ionic-app-scripts 0.0.45
[10:27:08]  ngc started ...
[10:27:20]  ngc finished in 11.93 s

Steps to reproduce:

  1. Create a new project ionic start MyIonic2Project tutorial --v2
  2. Update package.json devDependencies with "@ionic/app-scripts": "0.0.47"
  3. Perform Upgrade steps for ionic-app-scripts 0.0.47
  4. Update package.json with ngc command.
  5. Run npm run ngc

package.json (scripts section)

"scripts": {
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve",
    "ngc": "ionic-app-scripts ngc"
  }

Which @ionic/app-scripts version are you using?
0.0.47

Other information:
I have tracked this down to node_modules/@ionic/app-scripts/dist/util/hybrid-file-system-factory.js:

"use strict";
var hybrid_file_system_1 = require('./hybrid-file-system');
var helpers_1 = require('./helpers');
var instance = null;
function getInstance() {
    if (!instance) {
        instance = new hybrid_file_system_1.HybridFileSystem(helpers_1.getContext().fileCache);
    }
    return instance;
}
exports.getInstance = getInstance;

helpers_1.getContext() is undefined at this point only when running ngc independent from ionic build

@danbucholtz
Copy link
Contributor

danbucholtz commented Dec 14, 2016

Hi @bildonia,

This is out of scope at this time. If you want to run ngc directly, please use Angular's compiler-cli ngc binary. We use a custom ngc task that relies on other tasks, so it would be very difficult to get this to work in a stand-alone fashion.

Thanks,
Dan

@bildonia
Copy link
Author

@danbucholtz Then why is this in the "All Available Tasks" section of the documentation?
https://github.com/driftyco/ionic-app-scripts

ngc | Runs just the ngc portion of the production build.

@danbucholtz
Copy link
Contributor

I'll update the docs. Thanks for the heads up.

Thanks,
Dan

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