Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable ability to use rxjs-compat #2303

Open
danboone opened this issue Jun 25, 2018 · 2 comments
Open

enable ability to use rxjs-compat #2303

danboone opened this issue Jun 25, 2018 · 2 comments

Comments

@danboone
Copy link

danboone commented Jun 25, 2018

I'm submitting a ... (check one with "x")

[X] bug report => search github for a similar issue or PR before submitting

**Current behavior**
Existing project wanting to update project to current state of seed.  Problem is have lots of  code to update for the rxjs breaking change.  so wanted to still update but have  time to update the code as i could.

**Expected behavior**
existing code to compile and app to execute as expected

**Minimal reproduction of the problem with instructions**
rxjs-compat isn't established in the seed anywhere so that it doesn't break existing code.

**What is the motivation / use case for changing the behavior?**
ability to upgrade existing projects to Angular 6 and rxjs 6 and update code as can to fix the breaking change


* **Node:** `node --version` = 8.11.2
@aelbore
Copy link
Contributor

aelbore commented Jul 26, 2018

@danboone just update this file => https://github.com/mgechev/angular-seed/blob/master/tools/tasks/seed/bundle.rxjs.ts

use this code

const Builder = require('systemjs-builder');
const promisify = require('util').promisify;
const fs = require('fs');

async function bundleRxjs(){
  const options = {
    normalize: true,
    runtime: false,
    sourceMaps: true,
    sourceMapContents: false,
    minify: true, 
    mangle: false
  };
  const builder = new Builder('./');
  builder.config({
    paths: {
      'n:*': 'node_modules/*',
      'rxjs/*': 'node_modules/rxjs/*.js',
      "rxjs-compat/*": "node_modules/rxjs-compat/*.js",
      "rxjs/internal-compatibility": "node_modules/rxjs/internal-compatibility/index.js",
      "rxjs/testing": "node_modules/rxjs/testing/index.js",
      "rxjs/ajax": "node_modules/rxjs/ajax/index.js",
      "rxjs/operators": "node_modules/rxjs/operators/index.js",
      "rxjs/webSocket": "node_modules/rxjs/webSocket/index.js",
    },
    map: {
      'rxjs': 'n:rxjs',
      'rxjs-compat': 'n:rxjs-compat'
    },
    packages: {
      'rxjs': { main: 'index.js', defaultExtension: 'js' },
      "rxjs-compat": { main: "index.js", defaultExtension: "js" }
    }
  });
  return builder.bundle('rxjs + rxjs/Rx', 'node_modules/.tmp/Rx.min.js', options)
    .then(output => {
      const writeFile = promisify(fs.writeFile);
      const code = output.source.replace(/rxjs\/index/gm, 'rxjs');
      return writeFile('node_modules/.tmp/Rx.min.js', 
        (options.sourceMaps) 
          ? code + `\n//# sourceMappingURL=Rx.min.js.map`
          : code);
    });
}

@tsvetomir
Copy link
Contributor

To add to this issue, rxjs-compat may be required by third-party libraries, not just by the application.

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

No branches or pull requests

3 participants