Skip to content

Commit a1a6981

Browse files
committed
update microbundle, add optimized UMD and CJS builds
1 parent 58acdb0 commit a1a6981

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
"version": "1.0.1",
44
"description": "The Tagged Template syntax for Virtual DOM. Only browser-compatible syntax.",
55
"main": "dist/htm.js",
6-
"umd:main": "dist/htm.js",
6+
"umd:main": "dist/htm.umd.js",
77
"module": "dist/htm.mjs",
88
"scripts": {
99
"build": "npm run -s build:main && npm run -s build:preact && npm run -s build:babel",
10-
"build:main": "microbundle src/index.mjs -f es,umd --no-sourcemap --target web",
11-
"build:preact": "microbundle src/integrations/preact/index.mjs -o preact/index.js -f es,umd --external preact,htm --no-sourcemap --target web && cp src/integrations/preact/{index.d.ts,package.json} preact/ && npm run -s build:preact:standalone",
10+
"build:main": "microbundle src/index.mjs -f es,umd --no-sourcemap --target web && microbundle src/cjs.mjs -f iife --no-sourcemap --target web",
11+
"build:preact": "microbundle src/integrations/preact/index.mjs -o preact/index.js -f es,umd --external preact,htm --no-sourcemap --target web && npm run -s copy:preact:static && npm run -s build:preact:standalone",
12+
"copy:preact:static": "cp src/integrations/preact/index.d.ts src/integrations/preact/package.json preact/",
1213
"build:preact:standalone": "microbundle src/integrations/preact/standalone.mjs -o preact/standalone.js -f es,umd --no-sourcemap --target web",
1314
"build:babel": "cd packages/babel-plugin-htm && npm run build",
1415
"test": "eslint src/**/*.mjs test && npm run build && jest test",
@@ -53,7 +54,7 @@
5354
"eslint": "^5.2.0",
5455
"eslint-config-developit": "^1.1.1",
5556
"jest": "^23.4.2",
56-
"microbundle": "^0.7.0",
57+
"microbundle": "^0.8.3",
5758
"preact": "^8.2.9"
5859
},
5960
"dependencies": {}

src/cjs.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import htm from './index.mjs';
2+
if (typeof module != 'undefined') module.exports = htm;
3+
else self.htm = htm;

0 commit comments

Comments
 (0)