Skip to content

Commit

Permalink
use cjs to transpile the mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Feb 22, 2023
1 parent 9cdb1cb commit c98e487
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -13,7 +13,7 @@
"build": "npm run prepare",
"pretest": "npm run prepare",
"presnap": "npm run prepare",
"prepare": "node ./scripts/transpile-to-esm.mjs",
"prepare": "node ./scripts/transpile-to-esm.js",
"size": "size-limit",
"test": "tap",
"snap": "tap",
Expand Down
7 changes: 7 additions & 0 deletions scripts/transpile-to-esm.js
@@ -0,0 +1,7 @@
#!/usr/bin/env node

const { readFileSync, writeFileSync } = require('fs')
const { resolve } = require('path')
const cjs = readFileSync(resolve(__dirname, '../index.js'), 'utf8')
const esm = cjs.replace(/module.exports\s*=\s*/, 'export default ')
writeFileSync(resolve(__dirname, '../index.mjs'), esm, 'utf8')
9 changes: 0 additions & 9 deletions scripts/transpile-to-esm.mjs

This file was deleted.

0 comments on commit c98e487

Please sign in to comment.