Skip to content

_catch vs catch breaks ESM code built against the rxjs umd bundle #1924

@IgorMinar

Description

@IgorMinar

RxJS version:
beta.11

Code to reproduce:

import {_catch} from 'rxjs/operator/catch';

full source: https://github.com/angular/angular/blob/ee88c3c976654f15d41f8d35345ad96026fe5fe8/modules/%40angular/router/src/apply_redirects.ts#L14

  • rollup config:
export default {
  entry: '../../../dist/packages-dist/router/index.js',
  dest: '../../../dist/packages-dist/router/bundles/router.umd.js',
  format: 'umd',
  moduleName: 'ng.router',
  globals: {
    ...
    'rxjs/operator/catch': 'Rx.Observable.prototype'
  }
}

full source: https://github.com/angular/angular/blob/ee88c3c976654f15d41f8d35345ad96026fe5fe8/modules/%40angular/router/rollup.config.js#L30

Expected behavior:

the router bundle should be able to get hold of the _catch operator from the prototype via _catch property.

Actual behavior:

the _catch operator is not found because in the UMD bundle it was exported as catch (without the leading underscore).

Additional information:

Angular router bug that first raised this issue: angular/angular#11300
Reproduction: http://plnkr.co/edit/aSPFwbLNxlT5sQzSyGIN?p=preview

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions