Uncaught SyntaxError: Use of const in strict mode in chrome 40 - reactjs

Our ReactJS application created using create-react-app is not getting indexed in google. Upon investigation, found out that google crawler is using Chrome v40 engine to parse client side apps. So I got hold of Chrome 40 and tried to load the page. I got an error in console saying
Loading chunk 13 failed. Uncaught SyntaxError: Use of const in strict
mode.
I tried to apply polyfill (babel polyfill as well as some others) but this error is not going away.
Any advise? Is there anything I can do to make create-react-app to correctly transpile the code to Chrome 40 compatible ?

The issue happened because i was using a component which was not compatible. https://github.com/yahoo/react-stickynode. It worked perfectly after i removed this.

Related

React app "Uncaught SyntaxError: Unexpected token '<'" when running in prod

I cannot seem to solve this issue I am having with React. In development mode, my react app works fine. When I try to run it in production with Docker, it does not work. So I tried checking the index.html and when I open it I see two "Uncaught SyntaxError: Unexpected token '<'" error messages as well as "Failed to load resource: net::ERR_BLOCKED_BY_CLIENT" with some kind of facebook link?
I used a template when making the react app.
Any ideas why I am getting the uncaught syntax error? Please let me know, any help is appreciated, thanks.
Removing the homepage line entirely from the package.json in the react app directory fixed it somehow.
good luck to anyone with similar issue.

TypeError: undefined is not an object (evaluating 'row[OBJECT_COLUMN_NAME] = key') | React Native

Currently, I am building a MobileApp with React-Native and everything works fine until today :/
Unfortunately today the app throws an error (see below) after a successful build!
[TypeError: undefined is not an object (evaluating 'row[OBJECT_COLUMN_NAME] = key')]
BUT this error only appears in the normal mode -> if I switch to the debug mode everything is working without any further problems.
So after that, I started searching the trigger of this error and I found it (See below)
Your_App/node_modules/react-native/Libaries/polyfills/console.js (Line 449)
But as you can see that isn't from me it's from React-Native and I am not able to resolve this problem
After a long research on the internet, I couldn't figure out anything because nobody has got this error yet :/
But I think it has something to do with the newest react-native firebase version 6.0.0 (https://invertase.io/blog/react-native-firebase-v6)
Because it fails near there (See below)
Note: After recreating the app (not hard with git) the error appears again after a while :/
Note: A empty App still works on my engine
What do I use:
react-native 0.61.5
java 13
(All used libraries)
I would appreciate help ^^
Thank you
After I filled my code completely with console.logs... I found out that React Native does not work with console.table in non debug mode.
This is easily fixed by using console.table only when the app is in debug mode. Just check if the debug mode is enabled ^^
const isDebuggingEnabled = (typeof atob !== 'undefined');
That's it

'Uncaught TypeError: angular.module(...).run(...) is not a function' in Grunt minified js-file

My code works on development mode, uncompressed. But when I use grunt's minify functionality and run the app in production mode, I get that error: Uncaught TypeError: angular.module(...).run(...) is not a function.
When I look into the error in Google Chrome Developer Tools, I get what you see in the screenshot. Does anybody understand where the problem is?
I am using Angular 1.4+ in Angular-Fullstack. The error occurs in vendor.{{randomstring}}.js.
Thanks for any support!
You have 2 issues here.
Dependency injection. You can edit manually the archives or use https://github.com/mgol/grunt-ng-annotate this will do this automagically for you.
Concatenation. Check this grunt plugin https://github.com/gruntjs/grunt-contrib-concat the issue here is javascript dont understand when a function end/start because dont have a separation mark, check where the error is.
})(function(a,b) {
It should be:
});(function(a,b) {
Check the "Concatenating with a custom separator" example of grunt-contrib-concat

Angular2 (Typescript) with STS

How to make Angular2 code written in typescript run in spring-tool-suite?
I can run the Angular 2 code written in javascript in spring-tool-suite, but in case of typescript, I am facing a lot of problems in the form of:
1. NOT FOUND errors
I am attaching a screen shot for the error
The errors you are getting (404 on javascript files) points that the backend (web server) is not configured correctly.
Potential Fix
Give webpack a go so that you only need to load a single bundle.js instead of having to over configure a web server backend.

Angular + WebAPI - Getting: Uncaught Syntax Error: Unexpected Token <

I feel stuck with an issue that is probably something very simple, but I just cannot figure it out.
I'm writing a small app in Visual Studio 2015 using AngularJS and WebAPI. It all works 100 % correctly in both debug and release mode if I run the app from VS itself. It also works through WebMatrix when I publish the debug version of the app to a folder. But when I publish the release version to a folder and trying to view the app in the browser (using WebMatrix), I receive:
Uncaught SyntaxError: Unexpected token < modernizr:1
Uncaught SyntaxError: Unexpected token < jquery:1
Uncaught SyntaxError: Unexpected token < bootstrap:1
Uncaught SyntaxError: Unexpected token < angularjs:1
Uncaught SyntaxError: Unexpected token < modal:1
Uncaught SyntaxError: Unexpected token < app:1
It craps out on tag.
Somewhere I read I need to used the proper syntax in my AngularJS code to make sure the minification is done properly when the app is published. I've done all of that, yet I'm still getting this error. I'm also using ng-strict-di tag and I'm not receiving any errors.
I feel is somehow IIS (Express) + AngularJS related. I've made sure I using html5mode, setting the base href in my initial view, abd implemented routing in web.config. I'm not getting 404 when I refresh the page. I feel I've covered a lot, but it still does not work.
I've search the web up and down and have not been able to find anything that would indicate what needs to be done.
I'm kind of desperate and I'd appreciate any help at this moment.
Please and thanks...
I have actually figured it out (by pure chance).
It ended up to be that the main page (index) did not like #styles.render and #scripts.render. The whole setup did not like bundling.
As soon as I included the files individually I have configured in the bundles, it all started working.

Resources