Angular6 rxjs 6 update - angular6

Hi I appreciate these are a pain.
After updating Angular to version 6 and rxjs to version 6 we are getting a lot of browser errors that the system is unable to instantiate a number of packages.
We use a combination of node_modules and systemjs.config.server.js
without trying to start an argument on whether one is better than the other, If there are any improvements please let me know.
package.json
{
"version": "1.0.0",
"name": "infrastructure-annual-reporting",
"private": true,
"dependencies": {
"#angular/animations": "^6.0.0",
"#angular/cdk": "^6.0.0",
"#angular/common": "^6.0.0",
"#angular/compiler": "^6.0.0",
"#angular/core": "^6.0.0",
"#angular/forms": "^6.0.0",
"#angular/http": "^6.0.0",
"#angular/material": "^6.0.1",
"#angular/platform-browser": "^6.0.0",
"#angular/platform-browser-dynamic": "^6.0.0",
"#angular/router": "^6.0.0",
"angular-date-value-accessor": "^0.0.2",
"bootstrap": "^3.3.7",
"core-js": "^2.5.6",
"hammerjs": "^2.0.8",
"ng2-bs3-modal": "^0.13.0",
"ngx-accordion": "^0.0.17",
"nodemailer": "^4.6.4",
"rxjs": "^6.1.0",
"rxjs-compat": "^6.1.0",
"rxjs-tslint": "^0.1.3",
"socks": "^2.2.0",
"systemjs": "^0.21.3",
"web-animations-js": "^2.3.1",
"zone.js": "^0.8.26"
},
"devDependencies": {
"#angular/cli": "^6.0.0",
"#angular/language-service": "^6.0.0",
"#types/hammerjs": "^2.0.35",
"#types/jasmine": "^2.8.7",
"#types/node": "^10.0.6",
"codelyzer": "^4.3.0",
"jasmine": "^3.1.0",
"karma": "^2.0.2",
"lite-server": "^2.3.0",
"lodash": "^4.17.10",
"protractor": "^5.3.1",
"ts-node": "^6.0.3",
"tslint": "^5.10.0",
"typescript": "^2.8.3"
},
"keywords": [],
"license": "MIT",
"peerDependencies": {
"#angular/core": ">=2.0.0",
"#angular/common": ">=2.0.0",
"#angular/compiler": ">=2.0.0",
"#angular/platform-browser": ">=2.0.0",
"#angular/platform-browser-dynamic": ">=2.0.0",
"#angular/cdk": "6.0.1"
},
"repository": {},
"scripts": {
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"build:e2e": "tsc -p e2e/",
"serve": "lite-server -c=bs-config.json",
"serve:e2e": "lite-server -c=bs-config.e2e.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e",
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js",
"pretest": "npm run build",
"test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
"pretest:once": "npm run build",
"test:once": "karma start karma.conf.js --single-run",
"lint": "tslint ./src/**/*.ts -t verbose"
}
}
systemjs.config.server.js
(function (global) {
// map tells the System loader where to look for things
var paths = {
'npm:': "https://unpkg.com/"
};
var map = {
'app': "app", // 'dist',
'#angular': "node_modules/#angular",
'angular2-in-memory-web-api': "node_modules/angular2-in-memory-web-api",
'rxjs': "npm:rxjs",
'#angular/platform-browser/animations': "npm:#angular/platform-browser/bundles/platform-browser-animations.umd.min.js",
"ngx-accordion": "npm:ngx-accordion#0.0.17/index.js",
'#angular/common/http': "npm:#angular/common/bundles/common-http.umd.js",
'#angular/animations/browser': "npm:#angular/animations#5.2.10/bundles/animations-browser.umd.js",
'ng2-bs3-modal': "npm:ng2-bs3-modal/bundles/ng2-bs3-modal.umd.js",
'hammerjs':"npm:hammerjs/hammer.js",
// CDK individual packages
'#angular/cdk/bidi': "npm:#angular/cdk/bundles/cdk-bidi.umd.js",
'#angular/cdk/platform': "npm:#angular/cdk/bundles/cdk-platform.umd.js",
'#angular/cdk/keycodes': "npm:#angular/cdk/bundles/cdk-keycodes.umd.js",
'#angular/cdk/collections': "npm:#angular/cdk/bundles/cdk-collections.umd.js",
'#angular/cdk/portal': "npm:#angular/cdk/bundles/cdk-portal.umd.js",
'#angular/cdk/coercion': "npm:#angular/cdk/bundles/cdk-coercion.umd.js",
'#angular/cdk/overlay': "npm:#angular/cdk/bundles/cdk-overlay.umd.js",
'#angular/cdk/accordion': "npm:#angular/cdk/bundles/cdk-accordion.umd.js",
'#angular/cdk/observers': "npm:#angular/cdk/bundles/cdk-observers.umd.js",
'#angular/cdk/layout': "npm:#angular/cdk/bundles/cdk-layout.umd.js",
'#angular/cdk/scrolling': "npm:#angular/cdk/bundles/cdk-scrolling.umd.js",
'#angular/cdk/table': "npm:#angular/cdk/bundles/cdk-table.umd.js",
'#angular/cdk/stepper': "npm:#angular/cdk/bundles/cdk-stepper.umd.js",
'#angular/cdk/a11y': "npm:#angular/cdk/bundles/cdk-a11y.umd.js",
'#angular/cdk/tree' : "node_modules/#angular/cdk#6.0.1/tree",
'tslib': "npm:tslib/tslib.js",
'rxjs/operators' : "npm:rxjs/operators/"
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: "main.js", defaultExtension: "js" },
'rxjs': { defaultExtension: "js" },
'rxjs-compact': { defaultExtension: "js" },
'angular2-in-memory-web-api': { main: "index.js", defaultExtension: "js" }
};
var ngPackageNames = [
"animations",
"common",
"compiler",
"core",
"forms",
"http",
"material",
"platform-browser",
"platform-browser-dynamic",
"router"
];
// Individual files (~300 requests):
function packIndex(pkgName) {
packages["#angular/" + pkgName] = { main: "index.js", defaultExtension: "js" };
}
// Bundled (~40 requests):
function packUmd(pkgName) {
packages["#angular/" + pkgName] = { main: "bundles/" + pkgName + ".umd.js", defaultExtension: "js" };
}
// Most environments should use UMD; some (Karma) need the individual index files
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
// Add package entries for angular packages
ngPackageNames.forEach(setPackageConfig);
var config = {
paths: paths,
map: map,
packages: packages
};
System.config(config);
})(this);
the errors that we are seeing in the browser are

in cmd : npm install rxjs-compat#6 --save
in systemjs.config :
packages: {
app: {
defaultExtension: 'js',
meta: {
'./*.js': {
loader: 'systemjs-angular-loader.js'
}
}
},
main_angular_upgrade:{
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js', main: "index.js"
},
"rxjs-compat": { defaultExtension: 'js', main: "index.js" },
"rxjs/operators": { "main": "index.js", "defaultExtension": "js" },
"rxjs/internal-compatibility": { "main": "index.js", "defaultExtension": "js" },
"rxjs/testing": { "main": "index.js", "defaultExtension": "js" },
'rxjs/ajax': { main: 'index.js', defaultExtension: 'js' },
'rxjs/webSocket': { main: 'index.js', defaultExtension: 'js' }
}

Follow this official guidance to properly update your angular project:
https://update.angular.io/
You just need to select which version you are migrating from and your package manager (npm/yarn).
Then you'll have a list of things to do or check in order to have all set.
update check list

Related

Junit report not showing test cases

I'm using karma with jasmine and followed online guide by installing using
npm install --save-dev karma
and other necessities.
This is my karma config file.
module.exports = function(config) {
config.set({
frameworks: ['jasmine'],
plugins: [
require('karma-jasmine'),
require('karma-junit-reporter'),
"karma-chrome-launcher",
"karma-jasmine-html-reporter",
],
files: [
{ pattern: 'src/app/app.component.spec.ts', included: false,type :'js' },
// 'src/**/*.spec.ts',
// 'src/**/*.js'
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
// list of files / patterns to exclude
exclude: [
],
junitReporter: {
outputDir: '.',
outputFile: 'unit-test-result.xml',
useBrowserName: false
},
reporters: ['progress', 'kjhtml', 'junit'],
port: 9876,
colors: true,
logLevel: config.LOG_DEBUG,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
concurrency: Infinity
})
}
Some unit test cases are written in src/app/app.component.spec.ts file.
Junit Reporter is not writing the test cases in "unit-test-result.xml" file.
When I run "ng test" command the output comes as below
https://stackoverflowteams.com/c/neha/images/s/71deb22e-bb5f-44a2-84f2-5b4247db87c3.png
Now when I run "Karma Start" command , output comes as below
https://stackoverflowteams.com/c/neha/images/s/019ecb01-71ee-4c67-bbbf-02a2f1a1d581.png
No error shown in debug log, it shows statement as below
Chrome 109.0.0.0 (Windows 10): Executed 0 of 0 SUCCESS (0 secs / 0 secs)
and my "unit-test-result.xml" file generated with no test cases in it.
https://stackoverflowteams.com/c/neha/images/s/fe7a2dc7-7cd7-44c6-b7f3-c0eedf066e7c.png
Expected Output : I want my unit-test-result.xml to show 4 unit test cases.
my package.json is as below
{
"name": "angulat-test",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test --watch=false"
},
"private": true,
"dependencies": {
"#angular-devkit/build-angular": "^15.1.2",
"#angular/animations": "^15.1.0",
"#angular/common": "^15.1.0",
"#angular/compiler": "^15.1.0",
"#angular/core": "^15.1.0",
"#angular/forms": "^15.1.0",
"#angular/platform-browser": "^15.1.0",
"#angular/platform-browser-dynamic": "^15.1.0",
"#angular/router": "^15.1.0",
"karma-junit-reporter": "^2.0.1",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.12.0"
},
"devDependencies": {
"#angular/cli": "~15.1.2",
"#angular/compiler-cli": "^15.1.0",
"#types/jasmine": "~4.3.0",
"#types/node": "^18.11.18",
"jasmine-core": "~4.5.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"karma-typescript-preprocessor": "^0.4.0",
"typescript": "~4.9.4"
}
}
My tsconfig.spec.json
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"include": [
"src/app/app.component.spec.ts"
]
}
I am new to angular, any help would be highly appreciated.
Let me know if any more information is required.

Can't resolve 'primeng/components/utils/ObjectUtils'

I migrated my project from angular 4 to angular 6 it is running well on localhost but at AOT-build time it gets an error like:
ERROR in ./aot/app/home/accountant/customercost-form.component.ngfactory.ts
Module not found: Error: Can't resolve 'primeng/components/utils/ObjectUtils' in '/home/com5/Paresh/New Angular 6/AOT-6/aot/app/home/accountant'
# ./aot/app/home/accountant/customercost-form.component.ngfactory.ts 16:10-57
# ./aot/app/home/accountant/accounts.module.ngfactory.ts
# ./app/home/index.ts
# ./app/home/auth-guard.service.ts
# ./aot/app/app.module.ngfactory.ts
# ./app/main-aot.ts
ERROR in ./aot/app/home/accountant/vendorcost-form.component.ngfactory.ts
Module not found: Error: Can't resolve 'primeng/components/utils/ObjectUtils' in '/home/com5/Paresh/New Angular 6/AOT-6/aot/app/home/accountant'
# ./aot/app/home/accountant/vendorcost-form.component.ngfactory.ts 16:10-57
# ./aot/app/home/accountant/accounts.module.ngfactory.ts
# ./app/home/index.ts
# ./app/home/auth-guard.service.ts
# ./aot/app/app.module.ngfactory.ts
# ./app/main-aot.ts
ERROR in [at-loader] ./aot/app/app.module.ngfactory.ts:67:40
TS2339: Property 'ɵm' does not exist on type 'typeof import("/home/com5/Paresh/New Angular 6/AOT-6/node_modules/#angular/core/core")'.
my tsconfig-aot.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es2015","es2017", "dom"],
"noImplicitAny": true,
"removeComments": true,
"skipLibCheck": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"node_modules/#types/"
],
"outDir": "aot",
"baseUrl": ".",
"paths": {
"#angular/*": ["node_modules/#angular/*"]
}
},
"files": [
],
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit" : true
}
}
Package.json
{
"name": "My-app",
"version": "0.5.0",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"build:aot": "node --max_old_space_size=6144 node_modules/.bin/ngc -p tsconfig-aot.json && node --max_old_space_size=6144 node_modules/.bin/rollup -c rollup-config.js",
"lite:aot": "lite-server -c aot/bs-config.json",
"e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first",
"lint": "tslint ./app/**/*.ts -t verbose",
"lite": "lite-server",
"pree2e": "webdriver-manager update",
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
"test-once": "tsc && karma start karma.conf.js --single-run",
"tsc": "tsc",
"tsc:w": "tsc -w",
"ngc": " node --max_old_space_size=6144 node_modules/.bin/ngc -p tsconfig-aot.json",
"webpack-prod": " npm run ngc && npm run webpack",
"webpack": "node --max_old_space_size=6144 node_modules/.bin/webpack ",
"serve": "webpack-dev-server",
"prodserver": "node prodserver"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/angular/angular.io/blob/master/LICENSE"
}
],
"dependencies": {
"#angular/animations": "^6.1.10",
"#angular/common": "^6.1.10",
"#angular/compiler": "^6.1.10",
"#angular/compiler-cli": "^6.1.10",
"#angular/core": "^6.1.10",
"#angular/forms": "^6.1.10",
"#angular/http": "^6.1.10",
"#angular/platform-browser": "^6.1.10",
"#angular/platform-browser-dynamic": "^6.1.10",
"#angular/platform-server": "^6.1.10",
"#angular/router": "^6.1.10",
"#angular/upgrade": "^6.1.10",
"#auth0/angular-jwt": "^5.0.1",
"#ngtools/webpack": "^1.1.2",
"#types/googlemaps": "^3.2.0",
"#types/jquery": "^2.0.48",
"#types/jspdf": "^1.3.0",
"#types/node": "8.0.0",
"angular-in-memory-web-api": "^0.11.0",
"angular2-busy": "^1.0.2",
"angular2-datatable": "^0.5.3",
"angular2-datatable-pagination": "0.0.3",
"angular2-highcharts": "^0.5.5",
"angular2-image-upload": "^0.3.1",
"angular2-jwt": "^0.1.28",
"angular2-moment": "^1.0.0-beta.rc.1",
"angular2-multiselect-dropdown": "^2.9.0",
"angular2-router-loader": "^0.3.5",
"angular2-tag-input": "^1.2.3",
"bootstrap": "^3.3.7",
"bootstrap-datepicker": "^1.6.4",
"bootstrap-daterangepicker": "^2.1.25",
"bootstrap-timepicker": "^0.5.2",
"chart.js": "^2.8.0",
"core-js": "2.5.6",
"css-toggle-switch": "^4.0.2",
"express": "^4.15.3",
"fullcalendar": "^3.0.1-beta",
"highcharts": "7.1.1",
"install": "^0.10.1",
"lodash": "^4.17.11",
"moment": "2.18.1",
"mydatepicker": "^1.0.18",
"ng2-bootstrap": "^1.1.16",
"ng2-ckeditor": "1.2.0",
"ng2-datetime": "^1.4.0",
"ng2-device-detector": "^0.1.0",
"ng2-file-upload": "^1.2.0",
"ng2-imageupload": "^1.3.0",
"ng2-select2": "^1.0.0-beta.11",
"ng2-table": "^1.3.2",
"ngx-barcode": "^0.2.4",
"primeng": "^6.1.7",
"primeui": "^4.1.15",
"quill": "^1.3.0",
"reflect-metadata": "^0.1.9",
"rxjs": "6.3.2",
"rxjs-compat": "^6.6.3",
"rxjs-tslint": "^0.1.8",
"screenfull": "4.0.1",
"style-loader": "^0.17.0",
"systemjs": "0.19.40",
"tinymce": "^4.5.5",
"to-string-loader": "^1.1.5",
"tslib": "^2.0.1",
"typings": "^2.1.1",
"zone.js": "^0.8.26"
},
"devDependencies": {
"#angular/cli": "6.2.9",
"#types/file-saver": "0.0.1",
"#types/googlemaps": "^3.26.20",
"#types/jquery": "^2.0.48",
"#types/node": "7.0.7",
"angular-router-loader": "^0.6.0",
"angular2-template-loader": "0.6.2",
"angular2-toaster": "^6.1.0",
"awesome-typescript-loader": "3.1.3",
"canonical-path": "0.0.2",
"clean-webpack-plugin": "^0.1.16",
"compression-webpack-plugin": "^0.4.0",
"concurrently": "^3.0.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.1",
"electron-packager": "^8.7.0",
"extract-text-webpack-plugin": "^2.1.0",
"favicons-webpack-plugin": "0.0.7",
"file-loader": "^0.11.1",
"html-loader": "^0.4.3",
"html-webpack-plugin": "2.28.0",
"http-server": "^0.10.0",
"karma": "^5.2.2",
"lite-server": "^2.2.2",
"raw-loader": "^0.5.1",
"rollup": "^0.41.6",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-uglify": "^1.0.1",
"source-map-explorer": "^1.3.3",
"typescript": "2.9.2",
"webdriver-manager": "12.0.6",
"webpack": "^2.5.1",
"webpack-bundle-analyzer": "^2.8.1",
"webpack-dev-server": "2.4.5"
}
}
main-aot.ts
import { platformBrowser } from '#angular/platform-browser';
import { AppModuleNgFactory } from '../aot/app/app.module.ngfactory';
import { enableProdMode } from '#angular/core';
enableProdMode();
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
this is all my configuration files
Not sure if you're having the same problem I had, but when I upgraded from Angular 8 to 9 (and from PrimeNG 8 to 9), I needed to change the import path for ObjectUtils from "primeng/components/utils/ObjectUtils" to just "primeng/utils".

How to install all the dependencies and plugins using package.json in ionic

I have cloned ionic project from git in which the node_modules, platforms, plugins are not available but in the package.json i am having all the detail so whether i have to install all one by one or is there any short way where i can use the package.json and install all the node_modules, platforms and plugins.
package.json
{
"private": true,
"engines": {
"node": ">=4.0.0"
},
"scripts": {
"test": "gulp build --minify && gulp karma"
},
"devDependencies": {
"browser-sync": "^2.8.3",
"chalk": "^1.1.0",
"cordova": "^6.0.0",
"del": "^2.0.0",
"elementtree": "^0.1.6",
"eslint": "^3.0.0",
"gulp": "^3.9.1",
"gulp-angular-filesort": "^1.1.1",
"gulp-autoprefixer": "^3.0.1",
"gulp-changed": "^1.3.0",
"gulp-csso": "^2.0.0",
"gulp-eslint": "^3.0.0",
"gulp-filter": "^4.0.0",
"gulp-htmlmin": "^2.0.0",
"gulp-if": "^2.0.0",
"gulp-imagemin": "^3.0.1",
"gulp-inject": "^4.0.0",
"gulp-jsonlint": "^1.1.0",
"gulp-load-plugins": "^1.0.0-rc",
"gulp-natural-sort": "^0.1.0",
"gulp-ng-annotate": "^2.0.0",
"gulp-plumber": "^1.0.1",
"gulp-protractor": "^3.0.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^3.1.0",
"gulp-shell": "^0.5.1",
"gulp-size": "^2.0.0",
"gulp-sourcemaps": "^1.5.2",
"gulp-uglify": "^2.0.0",
"gulp-useref": "^3.0.4",
"karma": "^1.1.0",
"karma-angular-filesort": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-ng-html2js-preprocessor": "^1.0.0",
"karma-phantomjs-launcher": "^1.0.0",
"lodash": "^4.3.0",
"main-bower-files": "^2.9.0",
"minimist": "^1.2.0",
"phantomjs-prebuilt": "^2.1.4",
"plist": "git://github.com/akofman/plist.js.git#3f256fd21ab3ad3ada0f491cfc905098a2631342",
"proxy-middleware": "^0.15.0",
"require-dir": "^0.3.0",
"vinyl-paths": "^2.0.0",
"wiredep": "^4.0.0",
"xml2js": "^0.4.9",
"yeoman-test": "^1.1.0"
},
"generator-m-ionic": {
"proxies": [
{
"proxyMapFrom": "/postman-proxy",
"proxyMapTo": "https://echo.getpostman.com"
},
{
"proxyMapFrom": "/another-proxy",
"proxyMapTo": "https://echo.getpostman.com"
}
]
},
"dependencies": {
"angular-multiple-select": "^1.1.2",
"cordova-android": "^6.2.3",
"cordova-ios": "~4.3.1",
"cordova-plugin-device": "~1.1.5",
"cordova-plugin-network-information": "~1.3.2",
"cordova-plugin-whitelist": "1",
"cordova-plugin-x-toast": "~2.6.0",
"ionic-plugin-keyboard": "~2.2.1",
"pdfmake": "^0.1.31"
},
"cordova": {
"plugins": {
"cordova-plugin-x-toast": {},
"cordova-plugin-device": {},
"cordova-plugin-network-information": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {}
},
"platforms": [
"android",
"ios"
]
}
}
First install both ionic and cordova cli.(It is an ionic v1 project with android/ios platforms) from your package.json.
npm i -g cordova ionic
To install dependencies and devDependencies, do:
npm install
To install plugins and platforms as per package.json,
ionic cordova prepare
You may use the npm install command,
which will install all of the project dependencies locally.
npm official docs description for npm install command:
This command installs a package, and any packages that it depends on.
If the package has a package-lock or shrinkwrap file, the installation
of dependencies will be driven by that, with an npm-shrinkwrap.json
taking precedence if both files exist. See package-lock.json and
npm-shrinkwrap.
source

BabelJs over Heroku: Couldn't find preset "env" relative to directory "/app"

I have an application with SailsJs over NodeJs on Heroku and I can't run babeljs on. It runs ok on my localhost, but I always get the error:
Error: Couldn't find preset "env" relative to directory "/app"
The Heroku persists in look for itens at /app folder. This project does not have one /app folder
My app folders structure is:
app_name
- api
- assets
- config
- tasks
- views
I follow the documentation of http://babeljs.io to my .babelrc
.babelrc
now:
{
"presets": ["react", "env", "stage-1"],
"plugins": ["transform-class-properties"]
}
Already tried:
{
"presets": ["react", "es2015", "stage-1"],
"plugins": ["transform-class-properties"]
}
When I set the .babelrc to use es2015 I get the error:
Invalid:
`{ presets: [{option: value}] }`
Valid:
`{ presets: [['presetName', {option: value}]] }`
I already installed the dependencies
npm install babel-preset-es2015
npm install babel-preset-react
npm install babel --save-dev
My package.json
{
"name": "redux-cardeck",
"private": true,
"version": "0.0.1",
"engines": {
"node": "6.11.4"
},
"description": "a Sails-Redux application for multi-player online card game",
"keywords": [
"sailsjs",
"redux",
"es2015",
"webpack"
],
"dependencies": {
"axios": "^0.13.1",
"babel-cli": "^6.26.0",
"babel-plugin-transform-class-properties": "^6.11.5",
"babel-plugin-transform-object-rest-spread": "^6.6.5",
"babel-polyfill": "^6.7.2",
"babel-preset-stage-1": "^6.13.0",
"connect-mongo": "0.8.2",
"css-loader": "^0.23.1",
"ejs": "2.3.4",
"file-loader": "^0.8.5",
"grunt": "0.4.5",
"grunt-babel": "^6.0.0",
"grunt-contrib-clean": "0.6.0",
"grunt-contrib-coffee": "0.13.0",
"grunt-contrib-concat": "0.5.1",
"grunt-contrib-copy": "0.5.0",
"grunt-contrib-cssmin": "0.9.0",
"grunt-contrib-jst": "0.6.0",
"grunt-contrib-less": "1.1.0",
"grunt-contrib-uglify": "0.7.0",
"grunt-contrib-watch": "0.5.3",
"grunt-sails-linker": "~0.10.1",
"grunt-sync": "0.2.4",
"include-all": "~0.1.6",
"node-sass": "^3.8.0",
"postcss-modules-extract-imports": "^1.0.0",
"postcss-modules-scope": "^1.0.0",
"rc": "1.0.1",
"react": "^0.14.9",
"react-dom": "^0.14.9",
"react-redux": "^4.4.8",
"react-router": "^2.6.1",
"react-tap-event-plugin": "^0.2.2",
"redux": "^3.7.2",
"redux-form": "^5.3.2",
"redux-optimist": "0.0.2",
"redux-optimistic-ui": "^0.3.2",
"redux-promise": "^0.5.3",
"redux-thunk": "^2.1.0",
"redux-undo": "^0.6.1",
"sails": "~0.12.1",
"sails-disk": "~0.10.9",
"sails-hook-babel": "^6.0.1",
"sails-mongo": "^0.12.2",
"sails-postgresql": "^0.11.4",
"sails-service-mailer": "^3.2.1",
"sails-webpack": "^1.0.13",
"sass": "^0.5.0",
"sass-loader": "^3.2.3",
"style-loader": "^0.13.1",
"unexpected-react": "^1.0.0",
"updeep": "^0.16.1",
"url-loader": "^0.5.7"
},
"scripts": {
"debug": "node debug app.js",
"start": "./node_modules/.bin/babel-node app.js"
},
"main": "app.js",
"repository": {
"type": "git",
"url": "git://github.com/vanphuong12a2/redux-cardeck.git"
},
"author": "phuong",
"license": "",
"devDependencies": {
"axios-mock-adapter": "^1.6.1",
"babel-cli": "^6.26.0",
"babel-core": "^6.7.2",
"babel-loader": "^6.4.1",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"css-modules-require-hook": "^4.0.0",
"jsdom": "^8.1.0",
"react-tools": "^0.13.3",
"redux-devtools": "^3.4.0",
"redux-logger": "^2.6.1",
"source-map": "^0.5.3",
"unexpected": "^10.10.8",
"webpack-dev-server": "^1.14.1"
}
}
Someone already used BabelJs on Heroku before? I can't understand why it cant find babeljs at the package.json. I set the local of babel on heroku as
"scripts": {
"debug": "node debug app.js",
"start": "./node_modules/.bin/babel-node app.js"
},
I think it could be a problem with the relative structure of heroku or the fact I do not have a folder with name app
Thanks if someone can help me with this.
By default Heroku doesn't install the dependencies listed on "devDependencies" in your package.json.
You can either move your presets to "dependencies" or follow the steps here to alter this behavior.

Angular2 bundle.js:2 Uncaught ReferenceError: google is not defined

I use the 2.0.0-rc.4 version of Angular. I have always "google is not defined" problem in my console
console error
bundle.js:2 Uncaught ReferenceError: google is not defined
With Angular Beta without gulp, I have not had the problem.
typings folder content
my ** gulpfile.js** file
var gulp = require('gulp');
gulp.task('bundle', function() {
var SystemBuilder = require('systemjs-builder');
var builder = new SystemBuilder();
builder.loadConfig('./system.config.js')
.then(function(){
var outputFile = 'dist/bundle.js';
return builder.buildStatic('app', outputFile, {
minify: true,
mangle: true,
rollup: true
});
})
.then(function(){
console.log('bundle built successfully!');
});
});
package.json
{
"name": "angular2-poc",
"scripts": {
"clean": "gulp clean",
"compile": "gulp compile",
"build": "gulp build",
"postinstall": "typings install",
"test": "tsc && karma start",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" ",
"typings": "typings"
},
"devDependencies": {
"concurrently": "^1.0.0",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-jshint": "^2.0.1",
"gulp-minify": "0.0.11",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.1",
"gulp-uglify": "^1.5.3",
"gulp-util": "^3.0.7",
"jasmine-core": "~2.3.4",
"jshint": "^2.9.2",
"karma": "~0.13.15",
"karma-jasmine": "~0.3.6",
"karma-phantomjs2-launcher": "^0.3.2",
"lite-server": "2.0.1",
"path": "^0.12.7",
"systemjs-builder": "^0.15.16",
"traceur": "^0.0.91",
"typescript": "^1.7.3",
"yargs": "^4.7.0"
},
"dependencies": {
"#angular/common": "2.0.0-rc.4",
"#angular/compiler": "2.0.0-rc.4",
"#angular/core": "2.0.0-rc.4",
"#angular/http": "2.0.0-rc.4",
"#angular/platform-browser": "2.0.0-rc.4",
"#angular/platform-browser-dynamic": "2.0.0-rc.4",
"#angular/router": "3.0.0-beta.1",
"#angular/upgrade": "2.0.0-rc.4",
"#angular/forms": "0.2.0",
"es6-shim": "^0.35.0",
"events": "^1.0.2",
"fbjs": "^0.3.1",
"flux": "^2.1.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.27",
"zone.js": "^0.6.12"
}
}
My tsd.json file
{
"version": "v4",
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"googlemaps/google.maps.d.ts": {
"commit": "de82425735f84a10b43921ae4b1d085b3752a626"
}
}
}
Thanks you
Try loading these 2 files from your index.html
<script src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
For more details, refer this - https://developers.google.com/chart/interactive/docs/basic_load_libs
See if this helps.