When I try to download my application on an iOS device, I get the following error:
VMundefined bundle.js:1722 SyntaxError: Unexpected keyword 'const'. Const declarations are not supported in strict mode.
This error occurred on the iPhone 5s / 6s + several different iPads that I tried (I canβt remember). He also did not work on HTC. This error did not occur on any Samsung / Windows phones I tried. He also worked on desktop computers. (I have not tried to run it on Mac yet).
Here is this line of code from bundle.js;
{}],12:[function(require,module,exports){ "use strict"; const guage_1 = require("./charts/kpi/guage"); const stacked_1 = require("./charts/area/stacked"); const barChart_1 = require("./charts/compare/barChart");
When I remove "use strict" from bundle.js, it works fine on all devices. Just wondering if there is a way to make sure typescript is not compiling with "use strict" or fixing a problem with iOS devices?
Here is my gulpfile to compile (follow the manual published on typescripts website )
var gulp = require('gulp'), sourcemaps = require('gulp-sourcemaps'), source = require('vinyl-source-stream'), tsify = require('tsify'), browserSync = require('browser-sync'), postcss = require('gulp-postcss'), uglify = require('gulp-uglify'), concat = require('gulp-concat'), rename = require('gulp-rename'), watchify = require("watchify"), browserify = require('browserify'), gutil = require("gulp-util"), buffer = require('vinyl-buffer'), processorArray = [ ... ], watchedBrowserify = watchify(browserify({ basedir: '.', debug: true, entries: ['src/main.ts'], cache: {}, packageCache: {} }).plugin(tsify)), devPlugin = './src/plugins/'; function bundle() { return watchedBrowserify .bundle() .pipe(source('bundle.js')) .pipe(gulp.dest("dist")); } gulp.task('default', ['styles', 'browser-sync', 'watch'], bundle, function() { return browserify({ basedir: '.', debug: true, entries: ['src/main.ts'], cache: {}, packageCache: {} }) .plugin(tsify) .transform("babelify") .bundle() .pipe(source('bundle.js')) .pipe(buffer()) .pipe(sourcemaps.init({ loadMaps: true })) .pipe(sourcemaps.write('./')) .pipe(gulp.dest('dist')) }); watchedBrowserify.on("update", bundle); watchedBrowserify.on("log", gutil.log);