Skip to content

GridModule Angular-Cli (v1.6.4) ng build --prod fails with UglifyJs Error #1229

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

Closed
wmgdev opened this issue Jan 17, 2018 · 9 comments
Closed
Labels

Comments

@wmgdev
Copy link

wmgdev commented Jan 17, 2018

I'm submitting a...

  • Bug report

Current behavior

If I add the GridModule then do 'ng build --prod' I get.
ERROR in main.xxx.bundle.js from UglifyJs
TypeError: str.replace is not a function

Minimal reproduction of the problem with instructions

  1. Download the latest Angular-Cli (v1.6.4)
  2. Create a new angular cli project using 'ng new my-grid'
  3. 'cd my-grid'
  4. Download and install kendo grid package
npm install --save @progress/kendo-angular-grid @progress/kendo-angular-dropdowns @progress/kendo-angular-inputs @progress/kendo-angular-dateinputs @progress/kendo-data-query @progress/kendo-angular-intl @progress/kendo-angular-l10n @progress/kendo-drawing @progress/kendo-angular-excel-export @angular/animations
  1. import GridModule in your application root module
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { GridModule } from '@progress/kendo-angular-grid';
import { AppComponent } from './app.component';

@NgModule({
   bootstrap:    [AppComponent],
   declarations: [AppComponent],
   imports:      [BrowserModule, BrowserAnimationsModule, GridModule]
})
export class AppModule {
}
  1. run 'ng build --prod'

You get a build error.
ERROR in main.xxxxxx.bundle.js from UglifyJs
TypeError: str.replace is not a function

Environment

Package versions:

"@angular/animations": "^5.2.0",
    "@angular/common": "^5.1.0",
    "@angular/compiler": "^5.1.0",
    "@angular/core": "^5.1.0",
    "@angular/forms": "^5.1.0",
    "@angular/http": "^5.1.0",
    "@angular/platform-browser": "^5.1.0",
    "@angular/platform-browser-dynamic": "^5.1.0",
    "@angular/router": "^5.1.0",
    "@progress/kendo-angular-dateinputs": "^1.4.3",
    "@progress/kendo-angular-dropdowns": "^1.6.0",
    "@progress/kendo-angular-excel-export": "^1.0.5",
    "@progress/kendo-angular-grid": "^1.7.1",
    "@progress/kendo-angular-inputs": "^1.4.2",
    "@progress/kendo-angular-intl": "^1.3.0",
    "@progress/kendo-angular-l10n": "^1.0.5",
    "@progress/kendo-data-query": "^1.1.2",
    "@progress/kendo-drawing": "^1.4.1",
    "core-js": "^2.4.1",
    "rxjs": "^5.5.6",
    "zone.js": "^0.8.19"

System:

  • Node version: node v8.9.4
  • npm version: 5.6.0
  • angular cli version: 1.6.4
  • Platform: Windows 10
Angular CLI: 1.6.4
Node: 8.9.4
OS: win32 x64
Angular: 5.2.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.4
@angular-devkit/build-optimizer: 0.0.38
@angular-devkit/core: 0.0.25
@angular-devkit/schematics: 0.0.48
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.4
@schematics/angular: 0.1.13
@schematics/schematics: 0.0.13
typescript: 2.5.3
webpack: 3.10.0
@wmgdev
Copy link
Author

wmgdev commented Jan 17, 2018

BTW 'ng build --prod' works fine if you remove GridModule from app.module.ts

@rvrn22
Copy link

rvrn22 commented Jan 17, 2018

It seems like a @angular/cli uglify-es npm package issue. angular/angular-cli#9218
Pinning "uglify-es" to "3.3.5" fixes the issue.

@billdwhite
Copy link

I've got mine locked to 3.3.5 and I'm still getting this for the grid component

@rvrn22
Copy link

rvrn22 commented Jan 17, 2018

I had to delete my node_modules folder and package-lock.json and then npm install again to get the correct dependencies.

@wmgdev
Copy link
Author

wmgdev commented Jan 18, 2018

Yay, Thanks all.
Just to confirm I had to do all of the following to get this to work.

  1. Add "uglify-es": "3.3.5", to devDependancies in package.json
  2. Delete node_modules folder
  3. delete package-lock.json file
  4. npm install

ng build --prod then worked.

This is probably a Angular-cli / Uglify issue rather than Kendo Grid... but Kendo GridModule was the only module in my package.json that made it surface.
Thanks again

@danielkaradachki
Copy link
Contributor

We have applied a workaround for the error in the package for which it was thrown - telerik/kendo-intl. Updating the package should also resolve the problem.

@acohenOT
Copy link

@danielkaradachki I see this same error issue using @progress packages. Is there an update for those as well?

@danielkaradachki
Copy link
Contributor

Which packages? The error would be thrown for packages that have dependency to progress/kendo-angular-intl which has dependency to telerik/kendo-intl.

@acohenOT
Copy link

Never mind. I updated all my packages again and now ng build is working properly.

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

No branches or pull requests

6 participants