Skip to content

Commit ae9e8af

Browse files
authored
fix: use esm in browsers
2 parents c8bc578 + b364224 commit ae9e8af

File tree

5 files changed

+496
-1348
lines changed

5 files changed

+496
-1348
lines changed

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
"TextDecoder"
88
],
99
"type": "module",
10-
"browser": "./src/lib.browser.js",
1110
"react-native": "./src/lib.react-native.js",
1211
"main": "./src/lib.cjs",
13-
"module": "./src/lib.js",
12+
"module": "./src/lib.mjs",
1413
"types": "./src/lib.d.ts",
1514
"exports": {
1615
".": {
17-
"browser": "./src/lib.browser.js",
18-
"import": "./src/lib.js",
16+
"import": "./src/lib.mjs",
1917
"require": "./src/lib.cjs"
2018
}
2119
},
@@ -35,10 +33,11 @@
3533
"author": "Irakli Gozalishvili <[email protected]>",
3634
"homepage": "https://github.com/gozala/web-encoding",
3735
"devDependencies": {
36+
"assert": "^2.0.0",
3837
"jest": "^26.6.3",
3938
"metro-react-native-babel-preset": "^0.64.0",
40-
"mocha": "8.2.1",
41-
"playwright-test": "1.2.0",
39+
"mocha": "8.3.2",
40+
"playwright-test": "2.1.0",
4241
"react-native": "^0.63.4"
4342
},
4443
"optionalDependencies": {

src/lib.browser.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/lib.js renamed to src/lib.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"use strict"
2-
31
// In node `export { TextEncoder }` throws:
42
// "Export 'TextEncoder' is not definedin module"
53
// To workaround we first define constants and then export with as.

test/test-lib.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TextEncoder, TextDecoder } from "../src/lib.js"
1+
import { TextEncoder, TextDecoder } from "../src/lib.mjs"
22
import assert from "assert"
33

44
describe("text encode/decode", () => {

0 commit comments

Comments
 (0)