Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught TypeError: this._input.charCodeAt is not a function

I created an Angular 2 project using Angular 2 CLI and used ng build --prod command and got no errors.

When I upload the dist folder into my website, I get the following error when the app loads:

enter image description here

Uncaught TypeError: this._input.charCodeAt is not a function_Tokenizer._advance @ main .688167 c….bundle.js: 1716 _Tokenizer @ main .688167 c….bundle.js: 1716 tokenize @ main .688167 c….bundle.js: 1709 Parser.parse @ main .688167 c….bundle.js: 219 HtmlParser.parse @ main .688167 c….bundle.js: 380 DirectiveNormalizer.normalizeLoadedTemplate @ main .688167 c….bundle.js: 598 DirectiveNormalizer.normalizeTemplateSync @ main .688167 c….bundle.js: 598 DirectiveNormalizer.normalizeDirective @ main .688167 c….bundle.js: 598 RuntimeCompiler._createCompiledTemplate @ main .688167 c….bundle.js: 1090(anonymous
function) @ main .688167 c….bundle.js: 1090(anonymous
function) @ main .688167 c….bundle.js: 1090 RuntimeCompiler._compileComponents @ main .688167 c….bundle.js: 1090 RuntimeCompiler._compileModuleAndComponents @ main .688167 c….bundle.js: 1090 RuntimeCompiler.compileModuleAsync @ main .688167 c….bundle.js: 1090 PlatformRef_._bootstrapModuleWithZone @ main .688167 c….bundle.js: 717 PlatformRef_.bootstrapModule @ main .688167 c….bundle.js: 717(anonymous
function) @ main .688167 c….bundle.js: 1509 __webpack_require__ @ inline.js: 1(anonymous
function) @ main .688167 c….bundle.js: 2131 __webpack_require__ @ inline.js: 1 window.webpackJsonp @ inline.js: 1(anonymous
function) @ main .688167 c….bundle.js: 1

I'm using the latest Angular 2 CLI with webpack and Angular 2 RC.7

What could have gone wrong?

The this._input.charCodeAt is only used in the angular compiler folder as below: enter image description here

like image 347
TheUnreal Avatar asked Sep 14 '16 13:09

TheUnreal


1 Answers

The raw-loader has changed. You have to use .default when requiring the xlf file.

const translations = require('raw-loader!./i18n/messages.ko.xlf').default;

I faced same issue when I have updated @ngx-translate/i18n-polyfill to version 1.0.0 in my angular project. And issue has fixed when I implemented above changes

Refer: ngx-translate/i18n-polyfill Issue#60

like image 89
Nupin Avatar answered Sep 21 '22 09:09

Nupin