Skip to content

Commit c9e4da6

Browse files
committed
Use explicit file extensions for cjs and mjs exports
(closes #44) - I hope?
1 parent f42a1ef commit c9e4da6

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ You can also use **country-coder** directly in a web browser. A good way to do t
7777
The latest versions of many web browsers now support [ES6 modules in script tags](https://caniuse.com/#feat=es6-module) like this:
7878
```html
7979
<script type="module">
80-
import { iso1A2Code } from 'https://cdn.jsdelivr.net/npm/@ideditor/country-coder@5.0/dist/country-coder.esm.min.js';
80+
import { iso1A2Code } from 'https://cdn.jsdelivr.net/npm/@ideditor/country-coder@5.0/dist/country-coder.mjs';
8181
var result = iso1A2Code('Q145');
8282
</script>
8383
```

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ideditor/country-coder",
3-
"version": "5.0.0",
3+
"version": "5.0.1",
44
"description": "Convert longitude-latitude pairs to ISO 3166-1 codes quickly and locally",
55
"repository": "github:ideditor/country-coder",
66
"license": "ISC",
@@ -19,8 +19,8 @@
1919
"type": "module",
2020
"source": "./src/country-coder.ts",
2121
"types": "./dist/country-coder.d.ts",
22-
"main": "./dist/country-coder.cjs.js",
23-
"module": "./dist/country-coder.esm.js",
22+
"main": "./dist/country-coder.cjs",
23+
"module": "./dist/country-coder.mjs",
2424
"browser": "./dist/country-coder.iife.js",
2525
"dependencies": {
2626
"which-polygon": "^2.2.0"
@@ -42,8 +42,8 @@
4242
"clean": "shx rm -rf dist",
4343
"build": "run-s format-json build:**",
4444
"build:browser": "esbuild ./src/country-coder.ts --platform=browser --format=iife --global-name=countryCoder --bundle --sourcemap --outfile=./dist/country-coder.iife.js",
45-
"build:cjs": "esbuild ./src/country-coder.ts --platform=node --format=cjs --bundle --outfile=./dist/country-coder.cjs.js",
46-
"build:esm": "esbuild ./src/country-coder.ts --platform=neutral --format=esm --bundle --external:which-polygon --outfile=./dist/country-coder.esm.js",
45+
"build:cjs": "esbuild ./src/country-coder.ts --platform=node --format=cjs --bundle --sourcemap --outfile=./dist/country-coder.cjs",
46+
"build:mjs": "esbuild ./src/country-coder.ts --platform=neutral --format=esm --bundle --sourcemap --external:which-polygon --outfile=./dist/country-coder.mjs",
4747
"build:types": "tsc",
4848
"format-json": "node ./scripts/format-json.js",
4949
"test": "jest --env=node --colors --coverage tests",
@@ -55,7 +55,7 @@
5555
"jest": {
5656
"collectCoverage": true,
5757
"collectCoverageFrom": [
58-
"**/src/country-coder.ts"
58+
"./src/country-coder.ts"
5959
],
6060
"coverageDirectory": "<rootDir>/.coverage",
6161
"globals": {
@@ -68,9 +68,9 @@
6868
"js",
6969
"json"
7070
],
71-
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|ts?)$",
71+
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(js|ts)$",
7272
"transform": {
73-
"^.+\\.tsx?$": "ts-jest"
73+
"^.+\\.ts$": "ts-jest"
7474
},
7575
"verbose": true
7676
},

0 commit comments

Comments
 (0)