Skip to content

Commit 0682baa

Browse files
committed
build: add postpack script to remove module type from package.json
1 parent 96da818 commit 0682baa

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export default {
22
collectCoverage: true,
33
collectCoverageFrom: ['**/src/**/*.js', '!**/node_modules/**'],
44
coverageReporters: ['json', 'lcov', 'text', 'clover', 'text-summary'],
5+
modulePathIgnorePatterns: ['dist'],
56
testMatch: [
67
'**/__tests__/**/*.js',
78
/**

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
},
1414
"scripts": {
1515
"prepack": "babel src --out-dir dist",
16+
"postpack": "node --experimental-json-modules ./postpack.js",
1617
"lint": "eslint . src __tests__ --ext .js,.cjs",
1718
"test": "node --experimental-vm-modules ./node_modules/.bin/jest"
1819
},

postpack.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import fs from 'fs'
2+
3+
import pkg from './package.json'
4+
5+
/**
6+
* Remove "type": "module" until webpack supports ES modules better
7+
*/
8+
delete pkg.type
9+
10+
fs.writeFileSync('./dist/package.json', JSON.stringify(pkg, null, 2))

0 commit comments

Comments
 (0)