Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular 8.2.13 Build : An unhandled exception occurred: Unexpected token: punc ()) #465

Open
imtase opened this issue Nov 12, 2019 · 1 comment

Comments

@imtase
Copy link

imtase commented Nov 12, 2019

An unhandled exception occurred: Unexpected token: punc ()) when try to build for production in Angular with the command

ng build --prod --aot=true --commonChunk=true --optimization=true --vendorChunk=true --base-href=./ 

Screenshot from 2019-11-12 15-46-39

How to reproduce

1 - create a new angular app
2 - install the package npm install steem --save
3 - in app.component.ts

import { Component } from '@angular/core';

import * as steem from 'steem';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  title = 'steembug';

  constructor(){
    steem.api.getAccounts(['ned', 'dan'], function(err, result) {
      console.log(err, result);
    });    
  }
}

4 - to solve the error of Global in polyfills.ts add

(window as any).global = window;

5 - to solve the error of Buffer edit 'node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js' and modify node: false by

node: {crypto: true, stream: true}

Environment:

Screenshot from 2019-11-12 15-36-05

@miikkikiikki
Copy link

Will this be fixed soon? Same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants