Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jayphelps/rxjs-babel-only-tree-shaking-example
https://github.com/jayphelps/rxjs-babel-only-tree-shaking-example
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jayphelps/rxjs-babel-only-tree-shaking-example
- Owner: jayphelps
- Created: 2018-05-30T04:46:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-05-30T05:09:35.000Z (over 6 years ago)
- Last Synced: 2024-10-19T17:58:29.171Z (3 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DONT USE THIS AS IT DOESNT WORK IN ALL CASES. ONLY PUBLIC TO SHARE IN A DISCUSSION
```
npm install
npm run build
```#### Before
```js
import { of, from } from 'rxjs';
import { map, filter } from 'rxjs/operators';export const example = from(of(1, 2, 3)).pipe(
map(d => d * 10),
filter(() => true)
);
```#### After
```js
import { of } from 'rxjs/internal/observable/of';
import { from } from 'rxjs/internal/observable/from';
import { map } from 'rxjs/internal/operators/map';
import { filter } from 'rxjs/internal/operators/filter';export const example = from(of(1, 2, 3)).pipe(
map(d => d * 10),
filter(() => true)
);
```##### Notes
Works equally well with babel-preset-env, this demo just doesn't use any additional plugins or presets for simplicity.
Imports from the root `import { something } from 'rxjs'` aren't as easy, and currently this demo doesn't correctly handle some things, like scheduler imports. See [transform.js](transform.js)
***
:shipit: