Skip to content

Commit

Permalink
Merge pull request #7 from Gozala/fix/esm
Browse files Browse the repository at this point in the history
fix: esm support
  • Loading branch information
101arrowz authored Mar 2, 2022
2 parents e47a014 + be11ac3 commit 78c2e90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"version": "0.0.3",
"description": "High performance Zstandard (de)compression",
"main": "./lib/index.js",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"types": "./lib/index.d.ts",
"unpkg": "./umd/index.js",
"jsdelivr": "./umd/index.js",
"exports": {
".": {
"import": "./esm/index.js",
"import": "./esm/index.mjs",
"require": "./lib/index.js"
}
},
Expand Down
8 changes: 5 additions & 3 deletions scripts/rewriteBuilds.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readFileSync, writeFileSync } from 'fs';
import { readFileSync, writeFileSync, unlinkSync } from 'fs';
import { join } from 'path';
const atClass = /\/\*\* \@class \*\//g, pure = '/*#__PURE__*/';

Expand All @@ -9,5 +9,7 @@ writeFileSync(libIndex, readFileSync(libIndex, 'utf-8')
.replace(/exports\.(.*) = void 0;\n/, '')
);

const esmIndex = join(__dirname, '..', 'esm', 'index.js')
writeFileSync(esmIndex, readFileSync(esmIndex, 'utf-8').replace(atClass, pure));
const esm = join(__dirname, '..', 'esm');
const esmIndex = join(esm, 'index.js');
writeFileSync(join(esm, 'index.mjs'), readFileSync(esmIndex, 'utf-8').replace(atClass, pure));
unlinkSync(esmIndex);

0 comments on commit 78c2e90

Please sign in to comment.