I'm deploying a website but I am not able to "bundle" rxjs since I am using the final version of Angular. I can only deploy rxjs by copying the whole folder node_modules/rxjs on my website.
Here is my configuration of SystemJS
System.config({
map: {
'lodash':'http://127.0.0.1/js/lodash.min.js',
'@angular/core': 'http://127.0.0.1/js/core.umd.min.js',
'@angular/compiler': 'http://127.0.0.1/js/compiler.umd.min.js',
'@angular/common': 'http://127.0.0.1/js/common.umd.min.js',
'@angular/http': 'http://127.0.0.1/js/http.umd.min.js',
'@angular/platform-browser': 'http://127.0.0.1/js/platform-browser.umd.min.js',
'@angular/platform-browser-dynamic': 'http://127.0.0.1/js/platform-browser-dynamic.umd.min.js',
'@angular/router': 'http://127.0.0.1/js/router.umd.min.js',
'@angular/forms': 'http://127.0.0.1/js/forms.umd.min.js',
'@angular/upgrade': 'http://127.0.0.1/js/upgrade/bundles/upgrade.umd.js',
'rxjs':'http://127.0.0.1/js/vendors.bundle.js'
},
packages: {
'/js': {
defaultExtension: 'js'
}
},
bundles: {
'/js/app.bundle': ['main']
}
});
document.addEventListener('DOMContentLoaded', function () {
System.import('main').then(null, console.error.bind(console));
});
I'm including rxjs in vendors.bundle.js using the following Gulp script :
gulp.task('vendor.bundle', function() {
gulp.src([
'node_modules/systemjs/dist/system-polyfills.js',
'node_modules/zone.js/dist/zone.min.js',
'node_modules/reflect-metadata/Reflect.js',
'node_modules/systemjs/dist/system.src.js',
'node_modules/rxjs/bundles/Rx.min.js'
])
.pipe(concat('vendors.bundle.js'))
//.pipe(uglify())
.pipe(gulp.dest('./dist/js'));
});
I have errors like the following :
VM9314:3GET http://127.0.0.1/js/vendors.bundle.js/add/operator/map.js 404 (Not Found) ... Error loading http://127.0.0.1/js/vendors.bundle.js/add/operator/map.js as "rxjs/add/operator/map" from http://127.0.0.1/services/global-services/global.services
It's a problem because when we deploy the whole folder, that generate a huge count of request to get all rxjs/*.js files and implies poor performances mainly on mobile devices.
I had not have that perfs problem when I was deploying only the Rx.min.js file.
Can someone tell me how to deploy rxjs using Angular 2.2 et SystemJS ?