Skip to content

AOT Error: UglifyJs TypeError: str.replace is not a function at make_string #9218

@squadwuschel

Description

@squadwuschel

Versions

Output from: `ng --version`:

Angular CLI: 1.6.4
Node: 7.0.0
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.6.2
webpack: 3.10.0

Windows 7

### Repro steps

I can build my project in devmode, but when I try to compile my project in AOT mode with

ng build --prod

I get the following error.


- I've cleared the npm cache
- removed complete node_modules folder
- I've structured my App into small modules, when I comment out nearly all modules the error is still there => is AOT trying to compile the hole app when I don't use the module ?



### Observed behavior
ERROR in main.6a43ba34eae25a3e2b53.bundle.js from UglifyJs TypeError: str.replace is not a function at make_string (eval at <anonymous> (C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1), <anonymous>:5634:19)
at encode_string (eval at <anonymous> (C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1), <anonymous>:5678:19) at Object.print_string (eval at <anonymous> (C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1), <anonymous>:6091:27)  at print_property_name (eval at <anonymous> (C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1), <anonymous>:7179:20)
    at eval (eval at <anonymous> (C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1), <anonymous>:7211:17) at doit (eval at <anonymous>
	(C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1), <anonymous>:6152:13)
    at AST_ObjectKeyVal.eval (eval at <anonymous>
	(C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1), <anonymous>:6159:13)
    at AST_ObjectKeyVal.AST_Node.print (eval at <anonymous>
	(C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1), <anonymous>:5414:18)
    at eval (eval at <anonymous> (C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1),<anonymous>:7115:22)
    at Array.forEach (native)
	at eval (eval at <anonymous> (C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1), <anonymous>:7109:29)
    at eval (eval at <anonymous> (C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1), <anonymous>:5912:19)
    at OutputStream.with_indent (eval at <anonymous> (C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1), <anonymous>:5877:38)
    at Object.with_block (eval at <anonymous> (C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1), <anonymous>:5911:9)
    at eval (eval at <anonymous> (C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1), <anonymous>:7108:48)
    at doit (eval at <anonymous> (C:\TFS\DEV\30_Production\TestProjekt\0.2_ng5Update\10_Gui\Web\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools\node.js:1:1), <anonymous>:6152:13)

### Desired behavior
I can build the project with AOT


### Mention any other details that might be useful (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions