Open A50 opened 7 years ago
Which are the steps to reproduce the error? I am using it in prod mode and I have no errors so far.
i am migrate from angular2 to angular4. my app (angular4) in dev mode work without errors. I build app in prod mode, command ng build.
Error in terminal Unexpected token: name (EventsServiceModule). And app not build.
Can you paste here your app.module.ts?
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { EventsServiceModule } from 'angular-event-service';
@NgModule({
declarations: [
AppComponent
....
],
imports: [
BrowserModule, EventsServiceModule.forRoot(),
.....
],
providers: [...],
bootstrap: [AppComponent]
})
export class AppModule { }
Could you try without the .forRoot() ?
imports: [
BrowserModule, EventsServiceModule,
.....
],
unfortunately it did not help me
reproduce error by: ng new testError npm i angular-event-service add app.module.ts EventsServiceModule ng build --prod
I just followed your instructions and I got it working.
Could you check your angular-cli version? Mine is 1.1.1, I also printed ng --version
so you can checkout the versions I am using.
error appears after adding the code in app.component.ts
import { Component } from '@angular/core';
import { EventsService } from 'angular-event-service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
constructor( private eventsService: EventsService) {
this.eventsService.broadcast('test_error');
this.eventsService.on('test_error', () => { console.log('test_error') });
}
}
ERROR in vendor.774848f9d31e38c558d3.bundle.js from UglifyJs Unexpected token: name (EventsServiceModule) [vendor.774848f9d31e38c558d3.bundle.js:7767,4]
I have the same problem.
I will look for this when I have a bit more time.
i think, all the problems related to es6 syntax, one of the solutions to the problems that ng eject and the introduction of babel in the configuration of webpack. and try to run the command ng lint
Same problem here, any solution? I would avoid to eject the project..
----
@angular/cli: 1.4.3
node: 8.5.0
os: darwin x64
@angular/animations: 4.4.3
@angular/cdk: 2.0.0-beta.11
@angular/common: 4.4.3
@angular/compiler: 4.4.3
@angular/core: 4.4.3
@angular/forms: 4.4.3
@angular/http: 4.4.3
@angular/material: 2.0.0-beta.11
@angular/platform-browser: 4.4.3
@angular/platform-browser-dynamic: 4.4.3
@angular/router: 4.4.3
@angular/cli: 1.4.3
@angular/compiler-cli: 4.4.3
typescript: 2.5.2
What is the state of this issue?
I updated angular/cli to 1.6.7 then it works for me.
when my app, build in prod mode error: ERROR in vendor.774848f9d31e38c558d3.bundle.js from UglifyJs Unexpected token: name (EventsServiceModule) [vendor.774848f9d31e38c558d3.bundle.js:7767,4] How fix problem?