alxhub / io17

106 stars 21 forks source link

ngu-sw-manifest --module not working #12

Open ardnahcivar opened 7 years ago

ardnahcivar commented 7 years ago

Hi @alxhub I got this error any help

DELL@User MINGW32 ~/Desktop/Note/Triak (master) $ ./node_modules/.bin/ngu-sw-manifest --module src/app/app.module.ts

C:\Users\DELL\Desktop\Note\Triak\node_modules\ts-node\src\index.ts:312 throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset)) ^ TSError: ⨯ Unable to compile TypeScript Cannot find type definition file for 'firebase'. (2688) at getOutput (C:\Users\DELL\Desktop\Note\Triak\node_modules\ts-node\src\index.ts:312:17) at C:\Users\DELL\Desktop\Note\Triak\node_modules\ts-node\src\index.ts:343:18 at Object.compile (C:\Users\DELL\Desktop\Note\Triak\node_modules\ts-node\src\index.ts:502:17) at Module.m._compile (C:\Users\DELL\Desktop\Note\Triak\node_modules\ts-node\src\index.ts:406:44) at Module._extensions..js (module.js:580:10) at Object.require.extensions.(anonymous function) [as .ts] (C:\Users\DELL\Desktop\Note\Triak\node_modules\ts-node\src\index.ts:409:12) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17)

alxhub commented 7 years ago

Which version of firebase do you have installed?

ardnahcivar commented 7 years ago

hello @alxhub , i am using firebase-tools 3.7.0

shprink commented 7 years ago

I have the same problem with an Ionic app. Here is my error stack if it helps:

ngu-app-shell --module src/app/app.module.ts

/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/ts-node/src/index.ts:300
        throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
              ^
TSError: ⨯ Unable to compile TypeScript
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@angular/common/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@angular/core/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@angular/forms/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@angular/http/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@angular/platform-browser/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@ionic/storage/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@ngrx/core/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@ngrx/effects/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@ngrx/store/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@types/localforage/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@types/node/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@types/sha1/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@types/source-map/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@types/tapable/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@types/uglify-js/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/@types/webpack/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/angularfire2/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/ionic-angular/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/source-map/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/tapable/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
File '/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/uglify-js/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. (6054)
    at getOutput (/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/ts-node/src/index.ts:300:15)
    at /Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/ts-node/src/index.ts:330:16
    at Object.compile (/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/ts-node/src/index.ts:489:17)
    at Module.m._compile (/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/ts-node/src/index.ts:382:43)
    at Module._extensions..js (module.js:580:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/ts-node/src/index.ts:385:12)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
gund commented 7 years ago

I'm trying to use this tool with my project which is not based on angular cli but uses Webpack as a build tool. The stack is Angular 4, NgRx.

I've overcome majority of the issues while using --module flag but this one I cannot solve for now. So I have some global variables injected into code at the build time by webpack plugin and to make typescript know about those variable, I have declared them in one d.ts file.

But when I'm running this tool with --module flag it is saying that the variable is undefined. I was trying to import that d.ts file and reference in path and also declaring it manually with no luck.

Is there any possible way to fix it?

P.S.: Why do we need to run module on the server in the first place just to extract the metadata of the routes? We could just use TS compiler to get AST and then follow all lazy routes to build a routes tree...

UPDATE: I started work on POC to resolve routes via TS AST here. Any suggestion, feedback, participation is welcome =)

gund commented 7 years ago

Just a quick update here.

I progressed quite a bit with my work on static routes resolution and it is working with most of basic use cases. It's also already published to NPM so anyone can try it.

Is there a way to integrate that in this module so me and others can start using this library in the fullest? I can help with integration if needed though it is very easy to use anyway =)

gund commented 7 years ago

I wrote a little gist for those who want to be able to generate route manifest right now: https://gist.github.com/gund/651bdbe7339a40b94fab3c0e6a3b3fb2

playground commented 7 years ago

@alxhub I'm running into the same issue while building the docker image today after upgrading to typescript 2.3.4.

node_modules/ng-pwa-tools/bin/ngu-sw-manifest.js --module src/app/app.module.ts --out dist/ngsw-manifest.json

/src/node_modules/ts-node/src/index.ts:312 throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset)) ^ TSError: ⨯ Unable to compile TypeScript Cannot find type definition file for 'jasmine'. (2688) Cannot find type definition file for 'node'. (2688) Cannot find type definition file for 'q'. (2688) Cannot find type definition file for 'selenium-webdriver'. (2688) Cannot find type definition file for 'sha1'. (2688) src/app/app.module.ts (1,31): Cannot find module '@angular/platform-browser'. (2307) src/app/app.module.ts (2,26): Cannot find module '@angular/core'. (2307) src/app/app.module.ts (3,29): Cannot find module '@ngrx/store'. (2307) src/app/app.module.ts (4,29): Cannot find module '@angular/forms'. (2307) src/app/app.module.ts (5,28): Cannot find module '@angular/http'. (2307) src/app/app.module.ts (6,38): Cannot find module '@angular/router'. (2307) src/app/app.module.ts (7,41): Cannot find module '@angular/platform-browser/animations'. (2307) src/app/app.module.ts (8,46): Cannot find module '@angular/material'. (2307)