Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
an es module exposing the latest version of react and react-dom
Ever wanted to just import React into your project as a module without a build step or even script tags? It is 2019 now and browser support for native module imports is pretty good, so this should be possible but the react team – for one reason or another – haven't decided to provide a build that will let you do this yet.
This package however allows you import react and react-dom straight from a CDN:
import { React, ReactDOM } from 'https://unpkg.com/es-react';
ReactDOM.render(
React.createElement('h1', {}, 'Hello from es-react'),
document.body
)
Import React
and ReactDOM
directly from any script with type="module"
. The package is intended to be available from unpkg
(without having to append ?module
to the package name).
import { React, ReactDOM } from 'https://unpkg.com/es-react@16.8.3';
The version of this package is set to match the version of react that it exposes. It is strongly advised that you specify a version when requesting the module – this speeds up the request time and helps with caching. If you don't specify a number then unpkg will redirect and serve up the latest available version.
The latest (development) umd builds of react
and react-dom
– which you can find here and here respectively – were taken and edited by hand in order to suitable for distribution as an ES module.
This is currently an experiment but if it proves popular (and the react team don't decide to output a similar build) then perhaps I might decide to automate this process in order to keep this package up to date with latest releases.
Barely any of the code in this repo is written by myself. It is just a wrapper for React that is written and maintained by the team at Facebook. Thanks to my employer Formidable Labs for allowing me the time to think about and work on fun and experimental projects like this.
FAQs
an es module exposing the latest version of react and react-dom
The npm package esm-react receives a total of 0 weekly downloads. As such, esm-react popularity was classified as not popular.
We found that esm-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.