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

added support for rxjs v6 bundling#6

Open
mlakmal wants to merge 2 commits intoOasisDigital:masterfrom
mlakmal:master
Open

added support for rxjs v6 bundling#6
mlakmal wants to merge 2 commits intoOasisDigital:masterfrom
mlakmal:master

Conversation

@mlakmal
Copy link

@mlakmal mlakmal commented May 10, 2018

No description provided.

@kylecordes
Copy link
Contributor

I looked over the changes, and I don't think this handles all of the cases. It seems to have specific support for just rxjs/Observable for example, but not many other parallel parts of rxjs.

Here is a snippet of code from another project where I have this all running, I just haven't had time to publish it here yet. It includes support for the rxjs-compat backward compatibility also.

Unfortunately, it also has an exceedingly unpleasant approach to this compatibility. I haven't found a way yet to have a simpler system Builder configuration to get good results that include the -compat package, there probably is a way to do it, I just haven't had more than a few minutes to try yet.

const fs = require('fs');
const Builder = require('systemjs-builder');
const builder = new Builder('./');

builder.config({

  paths: {
    'rxjs/*': 'rxjs/*.js',
    'rxjs-compat/*': 'rxjs-compat/*.js',
    'rxjs/internal-compatibility': 'rxjs/internal-compatibility/index.js',
    'rxjs/testing': 'rxjs/testing/index.js',
    'rxjs/ajax': 'rxjs/ajax/index.js',
    'rxjs/operators': 'rxjs/operators/index.js',
    'rxjs/webSocket': 'rxjs/webSocket/index.js',
  },
  packages: {
    'rxjs': {
      main: 'index.js',
      defaultExtension: 'js'
    },
    'rxjs-compat': {
      main: "index.js",
      defaultExtension: "js"
    }
  },
  baseURL: "node_modules"
});

const options = {
  normalize: true,
  runtime: false,
  sourceMaps: false,
  sourceMapContents: false,
  minify: false,
  mangle: false
};

builder.bundle('rxjs + rxjs/Rx + rxjs/Observable', options).then(output => {
  let code = output.source
    .replace(/rxjs\/index/gm, 'rxjs')
    .replace(/"rxjs-compat\/add\/observable\//gm, '"rxjs/add/observable/')
    .replace(/"rxjs-compat\/add\/operator\//gm, '"rxjs/add/operator/');
  fs.writeFileSync('../minimal_lib/rxjs.js', code);
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants