A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ReactiveX/rxjs/issues/6321 below:

ESM version is never used · Issue #6321 · ReactiveX/rxjs · GitHub

Bug Report

Current Behavior
ES5 version is always used in client project when we build it with rollup or webpack even if we set mainFields to es2015 to take package.json attribute like in previous version.

CJS version is always used in node project even if we want to use module in latest node runtime.

This is due to the exports attribute in package.json which only declares node and default values.

Expected behavior
ESM version should be used when client project is built and we are using rxjs with import in javascript or typescript code and we want to build a script compatible with HTML <script type="module"> in HTML

ESM version should be used in node project if in package.json we set type:module attribute and we used it in latest runtime.

Reproduction
In a client project,

import { ajax, AjaxConfig, AjaxResponse } from 'rxjs/ajax';
import { Observable } from 'rxjs';

After that, you have to build the client project and you will see that only ES5 version is taken and not ESM version even if we set mainFields to es2015 in webpack or rollup config.

In a Node project,

import { Observable } from 'rxjs';

Build your project and in package.json set type:module and you will see that only CJS version is taken.

Environment

Possible Solution

You can see all possibilities here and we have to make a proposition to change package.json:exports attribute

You can see examples in the link provided before and they are explaining how to manage node and module version.

If we don't change the exports attribute, we should allow build system to take the good version we want using main, module or es2015 attributes from package.json like it was possible in previous version especially for client project.

samal-rasmussen, Kvek, Lodin, TheMcMurder, Ronsku and 5 moreRonskuRonsku and baronkokoRonsku and baronkoko


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4