Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

RxJS 5.5.0 ... and new lettable operators #4

Closed
mlc-mlapis opened this issue Oct 19, 2017 · 4 comments
Closed

RxJS 5.5.0 ... and new lettable operators #4

mlc-mlapis opened this issue Oct 19, 2017 · 4 comments

Comments

@mlc-mlapis
Copy link

mlc-mlapis commented Oct 19, 2017

Hi Kyle, @kylecordes, I am trying to solve a new problem with RxJS 5.5.0 and its new lettable operators.

Actually just simple GULP script produces the following problem:

Unhandled rejection Error on fetch for rxjs/operators at file:///.../node_modules/rxjs/operators.js
Loading rxjs/Rx
Error: ENOENT: no such file or directory, open '...\node_modules\rxjs\operators.js'

It is probably related to defaultExtension because operators.js doesn't exist in reality just the directory and these lines in Rx.js on 191-192:

var _operators = require('./operators');
exports.operators = _operators;

Do you have any idea how to solve it by the simplest way? I guess that the problem is the same even for rxjs-system-bundle.

// >>> GULP TASK to create the RxJS bundle
gulp.task('rxjs', function() {
	var options = {
		normalize: true,
		runtime: false,
		sourceMaps: true,
		sourceMapContents: true,
		minify: true,
		mangle: true
	};
	var builder = new systemjsbuilder('./');
	builder.config({
		paths: {
			"n:*": "node_modules/*",
			"rxjs/*": "node_modules/rxjs/*.js",
		},
		map: {
			"rxjs": "n:rxjs",
		},
		packages: {
			"rxjs": {main: "Rx.js", defaultExtension: "js"},
		}
	});
	builder.bundle('rxjs', 'rxjs-bundle/Rx.min.js', options);
});
// <<< GULP TASK to create the RxJS bundle
@kylecordes
Copy link
Contributor

@mlc-mlapis Thank you for this interesting question. Over here at Oasis Digital, we have been using the new lettable operators already. I like the new syntax quite a lot by the way.

The problem you're describing, is a problem I need to solve for the materials we use in our Angular classes. When (if) I have a solution, I will post it here when I figure it out. I have an idea, it might involve generating the missing file. I believe the RxJS team has been going back and forth about exactly what what should be included in the distribution, to enable optimized use (without bringing in too much code) for different scenarios. The answer they have is probably optimized for MPM. So we might need to do something slightly hacky to get great results with System.

@kylecordes
Copy link
Contributor

@mlc-mlapis I was able to build with exactly the same system bundle commands as before, by using a bit of script to fill in the "missing" operators.js file. This file is intentionally not present, as you described. I synthesize it from a very similar file that is present, using the awful hackery of a sed command to edit JavaScript code. You can see the details in this commit:

b0f714a

I'm using the same workaround in the materials we use to teach our class (Angular Boot Camp). In class we find it very convenient to work in the browser using SystemJS, but it is important to type exactly the same code that we would type in a Angular CLI application. So far it appears that this workaround achieves that.

@mlc-mlapis
Copy link
Author

@kylecordes ... yes, it is the right way till RxJS team will introduce version 5.5.1 with their solution of the same. They are aware of the problem already ... ReactiveX/rxjs#2971

Thank you very much for your time.

@phpcodexpert
Copy link

angular 5 support ngrx4 or not?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants