Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.

Commit 3be2338

Browse files
authored
Emit ESM bundle (#484)
1 parent ebc00c8 commit 3be2338

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

BUILD

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ load("@npm//@bazel/typescript:index.bzl", "ts_library")
44
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
55
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
66

7-
### Produce umd and cjs bundles
7+
### Produce umd, cjs and esm bundles
88

99
ts_library(
1010
name = "dev",
@@ -28,6 +28,7 @@ ts_library(
2828
)
2929
for format, args in {
3030
"cjs": [],
31+
"esm": [],
3132
"umd": [
3233
# Downlevel (transpile) to ES5.
3334
"-p",
@@ -67,6 +68,23 @@ pkg_npm(
6768
],
6869
)
6970

71+
genrule(
72+
name = "incremental-dom-esm",
73+
srcs = [":bundle.esm.js"],
74+
outs = ["dist/incremental-dom-esm.js"],
75+
cmd = "cp $(locations :bundle.esm.js) $@",
76+
)
77+
78+
pkg_npm(
79+
name = "npm-esm",
80+
substitutions = {
81+
"const DEBUG = true;": "const DEBUG = false;",
82+
},
83+
deps = [
84+
":incremental-dom-esm",
85+
],
86+
)
87+
7088
### Produce minified bundle
7189

7290
## Create a second index so that it can have a reference to the release/ directory.
@@ -131,6 +149,7 @@ pkg_npm(
131149
],
132150
nested_packages = [
133151
":npm-cjs",
152+
":npm-esm",
134153
":npm-min",
135154
":npm-umd",
136155
],

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "incremental-dom",
33
"version": "0.7.0",
44
"description": "An in-place virtual DOM library",
5+
"exports": "dist/incremental-dom-esm.js",
56
"main": "dist/incremental-dom-cjs.js",
67
"author": "The Incremental DOM Authors",
78
"license": "Apache-2.0",

0 commit comments

Comments
 (0)