Skip to content

Commit 0107206

Browse files
committed
Added esm.js export
1 parent bc8cac8 commit 0107206

4 files changed

Lines changed: 24 additions & 2 deletions

File tree

esm.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
"main": "cjs/index.js",
66
"types": "index.d.ts",
77
"scripts": {
8-
"build": "node pony.js && npm run cjs && npm run rollup:async && npm run rollup:es && npm run rollup:babel && drop-babel-typeof ./index.js && npm run min && npm run test && npm run size",
8+
"build": "node pony.js && npm run cjs && npm run rollup:async && npm run rollup:es && npm run rollup:esm && npm run rollup:babel && drop-babel-typeof ./index.js && npm run min && npm run test && npm run size",
99
"cjs": "rm cjs/*.js && ascjs --no-default esm cjs",
1010
"rollup:async": "rollup --config rollup/async.config.js && sed -i.bck 's/^var /self./' async.js && rm -rf async.js.bck",
1111
"rollup:es": "rollup --config rollup/es.config.js && sed -i.bck 's/^var /self./' es.js && rm -rf es.js.bck",
12+
"rollup:esm": "rollup --config rollup/esm.config.js",
1213
"rollup:babel": "rollup --config rollup/babel.config.js && sed -i.bck 's/^var /self./' index.js && rm -rf index.js.bck",
1314
"min": "sed -i.bck 's/function typeof/function _$/' index.js && rm -rf index.js.bck && terser index.js -c -m -o min.js",
1415
"size": "cat min.js | brotli | wc -c && cat es.js | brotli | wc -c",

rollup/esm.config.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {nodeResolve} from '@rollup/plugin-node-resolve';
2+
import {terser} from 'rollup-plugin-terser';
3+
import includePaths from 'rollup-plugin-includepaths';
4+
5+
export default {
6+
input: './esm/index.js',
7+
plugins: [
8+
includePaths({
9+
include: {
10+
'@ungap/create-content': 'node_modules/@ungap/degap/create-content.js'
11+
},
12+
}),
13+
nodeResolve(),
14+
terser()
15+
],
16+
17+
output: {
18+
file: './esm.js'
19+
}
20+
};

test/object.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<title>Document</title>
77
<script type="module">
88
// npx ucdn --debug
9-
import {render, html, svg} from '../esm/index.js';
9+
import {render, html, svg} from '../esm.js';
1010

1111
const dispatch = (id, detail) => () => {
1212
document.dispatchEvent(new CustomEvent(id, {detail}));

0 commit comments

Comments
 (0)