Skip to content

Commit

Permalink
Add legacy browsers target (#60)
Browse files Browse the repository at this point in the history
Fix #13
  • Loading branch information
afrokick authored Sep 26, 2023
1 parent 78878d4 commit d2c29a0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
14 changes: 14 additions & 0 deletions lib/legacy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as netlib from './index'

const target: any =
typeof globalThis !== 'undefined'
? globalThis
: typeof self !== 'undefined'
? self
: typeof window !== 'undefined'
? window
: typeof global !== 'undefined'
? global
: {}

target.netlib = netlib
24 changes: 22 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,29 @@
"source": "lib/index.ts",
"main": "dist/netlib.js",
"types": "dist/index.d.ts",
"legacy": "dist/legacy.js",
"sideEffects": [
"lib/legacy.ts"
],
"targets": {
"types": {
"source": "lib/index.ts"
},
"main": {
"source": "lib/index.ts"
},
"legacy": {
"source": "lib/legacy.ts",
"context": "browser",
"outputFormat": "global",
"engines": {
"browsers": "supports es6-module"
},
"includeNodeModules": true
}
},
"files": [
"dist/netlib.js",
"dist/netlib.js.map"
"dist/*"
],
"scripts": {
"prepare": "yarn build",
Expand Down

0 comments on commit d2c29a0

Please sign in to comment.