alxhub / io17

106 stars 21 forks source link

Unexpected token import #10

Open BorntraegerMarc opened 7 years ago

BorntraegerMarc commented 7 years ago

I get this error:

> komed-health-web@0.0.0 ngu-sw-manifest D:\projects\komed-health-web
> node ./node_modules/ng-pwa-tools/bin/ngu-sw-manifest.js --module src/app/app.module.ts --out dist/ngsw-manifest.json

D:\projects\komed-health-web\src\app\app.module.ts:2
import { NgModule, CUSTOM_ELEMENTS_SCHEMA  } from '@angular/core';
^^^^^^
SyntaxError: Unexpected token import

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

GuskiS commented 7 years ago

Same here.

BorntraegerMarc commented 7 years ago

Also I'm getting weird errors if this is my app.module.ts:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA  } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { PolymerModule } from '@codebakery/origami';
import { IronElementsModule, PaperElementsModule, AppElementsModule } from '@codebakery/origami/lib/collections';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    PolymerModule,
    IronElementsModule,
    PaperElementsModule,
    AppElementsModule
  ],
  providers: [],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  bootstrap: [AppComponent]
})
export class AppModule { }

Somebody knows why? This also happens on OSX...

shprink commented 7 years ago

Here is my error stack trace:

ngu-app-shell --module src/app/app.module.ts
/Users/julienrenaux/Sites/ionic-twitter-pwa/src/app/app.module.ts:7
import { BrowserModule } from '@angular/platform-browser';
^^^^^^
SyntaxError: Unexpected token import
    at Object.exports.runInThisContext (vm.js:78:16)
    at Module._compile (module.js:543:28)
    at Module.m._compile (/Users/julienrenaux/Sites/ionic-twitter-pwa/node_modules/ts-node/src/index.ts:382:23)
    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)
    at require (internal/module.js:20:19)
rmchndrng commented 7 years ago

I am also getting the same error, using the following gist for the time being https://gist.github.com/gund/651bdbe7339a40b94fab3c0e6a3b3fb2

chakrachi commented 7 years ago

Same here on error as above examples..

Pillin commented 6 years ago

i had the same issue, and solved it, deleting all .js and .js.map compiled, and then, i run build --prod again (without aot). After that, i run the command ngu-sw-manifest. if the next issue is "Error: ENOENT: no such file or directory", check if the all component had moduleId

DominicBoettger commented 6 years ago

Same here...

playground commented 6 years ago

Same issue here... When I try to apply app-shell as such

ngu-app-shell.js --module src/app/app.module.ts --out dist/index.html

(function (exports, require, module, __filename, __dirname) { import { Inject, Injectable, NgModule } from '@angular/core';
^
SyntaxError: Unexpected token import
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
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)
at require (internal/module.js:20:19)
at Object. (/Users/sandbox/src/app/app.module.ts:6:1)

app.module.ts:6:1 where it is referencing my private npm module