Skip to content

Commit ac2a7f4

Browse files
committed
export minified version by default
1 parent 8a34522 commit ac2a7f4

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
"preprofile": "npm run prepare",
2828
"profile": "make -C benchmark profile"
2929
},
30-
"main": "./dist/commonjs/index.js",
30+
"main": "./dist/commonjs/index.min.js",
3131
"types": "./dist/commonjs/index.d.ts",
3232
"tshy": {
3333
"exports": {
34-
".": "./src/index.ts",
35-
"./min": {
34+
"./raw": "./src/index.ts",
35+
".": {
3636
"import": {
3737
"types": "./dist/esm/index.d.ts",
3838
"default": "./dist/esm/index.min.js"
@@ -75,7 +75,7 @@
7575
]
7676
},
7777
"exports": {
78-
".": {
78+
"./raw": {
7979
"import": {
8080
"types": "./dist/esm/index.d.ts",
8181
"default": "./dist/esm/index.js"
@@ -85,7 +85,7 @@
8585
"default": "./dist/commonjs/index.js"
8686
}
8787
},
88-
"./min": {
88+
".": {
8989
"import": {
9090
"types": "./dist/esm/index.d.ts",
9191
"default": "./dist/esm/index.min.js"
@@ -97,5 +97,5 @@
9797
}
9898
},
9999
"type": "module",
100-
"module": "./dist/esm/index.js"
100+
"module": "./dist/esm/index.min.js"
101101
}

test/basic.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@ t.test('verify require works as expected', async t => {
1111
const req = createRequire(import.meta.url)
1212
t.equal(
1313
req.resolve('../'),
14-
req.resolve('../dist/commonjs/index.js'),
14+
req.resolve('../dist/commonjs/index.min.js'),
1515
'require resolves to expected module',
1616
)
17-
const { LRUCache } = await t.mockImport('../dist/esm/index.js', {})
17+
const { LRUCache } = await t.mockImport('../dist/esm/index.js')
18+
const { LRUCache: LRUCacheRaw } = await t.mockImport('lru-cache/raw')
1819
t.equal(LRUCache.toString().split(/\r?\n/)[0].trim(), 'class LRUCache {')
20+
t.equal(LRUCache.toString(), LRUCacheRaw.toString(), './raw endpoint is unminified')
21+
const { LRUCache: LRUCacheMain } = await t.mockImport('lru-cache')
22+
const { LRUCache: LRUCacheMin } = await t.mockImport('../dist/esm/index.min.js')
23+
t.equal(LRUCacheMin.toString(), LRUCacheMain.toString())
1924
})
2025

2126
t.test('basic operation', t => {

0 commit comments

Comments
 (0)