Skip to content

Commit

Permalink
Merge pull request #1 from serkodev/fix/exports-file-ext
Browse files Browse the repository at this point in the history
fix: exports file extensions
  • Loading branch information
vHeemstra authored Jul 10, 2024
2 parents 6bca022 + e4d44eb commit d2cd735
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
],
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.esm.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.cjs.js",
"import": "./dist/index.esm.js",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
}
},
Expand Down
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ isApng(new Uint8Array(buffer))
#### As old-school global script tag

Url for latest version: `https://unpkg.com/is-apng`<br>
Url for specific version: `https://unpkg.com/is-apng@1.0.1/dist/index.js`
Url for specific version: `https://unpkg.com/is-apng@1.1.0/dist/index.js`

```html
<script src="https://unpkg.com/is-apng" type="text/javascript"></script>
Expand All @@ -52,12 +52,12 @@ Url for specific version: `https://unpkg.com/[email protected]/dist/index.js`

#### As module

Url for latest version: `https://unpkg.com/is-apng/dist/index.esm.js`<br>
Url for specific version: `https://unpkg.com/is-apng@1.0.1/dist/index.esm.js`
Url for latest version: `https://unpkg.com/is-apng/dist/index.mjs`<br>
Url for specific version: `https://unpkg.com/is-apng@1.1.0/dist/index.mjs`

```html
<script type="module">
import isApng from 'https://unpkg.com/is-apng/dist/index.esm.js'
import isApng from 'https://unpkg.com/is-apng/dist/index.mjs'
console.log(typeof isApng);
// isApng(...)
Expand All @@ -72,7 +72,7 @@ or
<script type="importmap">
{
"imports": {
"is-apng": "https://unpkg.com/is-apng/dist/index.esm.js"
"is-apng": "https://unpkg.com/is-apng/dist/index.mjs"
}
}
</script>
Expand Down
6 changes: 3 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ export default [
],
output: [
{
file: `${isProduction ? 'dist' : 'lib'}/index.esm.js`,
file: `${isProduction ? 'dist' : 'lib'}/index.mjs`,
format: 'esm',
// sourcemap: isProduction,
},
{
name: 'isApng',
file: `${isProduction ? 'dist' : 'lib'}/index.cjs.js`,
file: `${isProduction ? 'dist' : 'lib'}/index.cjs`,
format: 'cjs',
// interop: 'auto',
// sourcemap: isProduction,
Expand Down Expand Up @@ -75,7 +75,7 @@ export default [
// ],
// output: {
// name: 'isApng',
// file: `${isProduction ? 'dist' : 'lib'}/index.cjs.js`,
// file: `${isProduction ? 'dist' : 'lib'}/index.cjs`,
// format: 'cjs',
// // interop: 'default',
// interop: 'auto',
Expand Down
2 changes: 1 addition & 1 deletion src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from 'ava'
import { readFileSync } from 'node:fs'
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import isApng from '../dist/index.esm.js'
import isApng from '../dist/index.mjs'

const dir =
typeof __dirname !== 'undefined'
Expand Down
2 changes: 1 addition & 1 deletion src/test-browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<!-- Module JS -->
<!--
<script type="module">
import isApng from './js/index.esm.js'
import isApng from './js/index.mjs'
if (typeof isApng !== 'function') {
console.error(
Expand Down

0 comments on commit d2cd735

Please sign in to comment.