fix: update package.json to properly handle bringing in exports with import or require
This commit is contained in:
+6
-4
@@ -33,11 +33,13 @@
|
|||||||
"package.json"
|
"package.json"
|
||||||
],
|
],
|
||||||
"main": "dist/cjs/index.js",
|
"main": "dist/cjs/index.js",
|
||||||
|
"module": "dist/esm/index.js",
|
||||||
"types": "dist/types/index.d.ts",
|
"types": "dist/types/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
"import": "./dist/esm/index.js",
|
".": {
|
||||||
"require": "./dist/cjs/index.js",
|
"import": "./dist/esm/index.js",
|
||||||
"default": "./dist/cjs/index.js"
|
"require": "./dist/cjs/index.js"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rimraf dist",
|
"clean": "rimraf dist",
|
||||||
@@ -45,7 +47,7 @@
|
|||||||
"lint-fix": "eslint --fix --ignore-path .eslintignore --ext .js,.ts . --max-warnings=0",
|
"lint-fix": "eslint --fix --ignore-path .eslintignore --ext .js,.ts . --max-warnings=0",
|
||||||
"format-staged": "pretty-quick --staged",
|
"format-staged": "pretty-quick --staged",
|
||||||
"format": "pretty-quick",
|
"format": "pretty-quick",
|
||||||
"build": "npm run tests && npm run clean && tsc --project tsconfig.cjs.json && tsc --project tsconfig.esm.json",
|
"build": "npm run tests && npm run clean && tsc --project tsconfig.cjs.json && tsc --project tsconfig.esm.json && ./scripts/create_dist_package_json.sh",
|
||||||
"test:unit": "mocha -r ts-node/register",
|
"test:unit": "mocha -r ts-node/register",
|
||||||
"test:integration": "mocha -r ts-node/register -r integrationTests/mochaRootHooks.ts",
|
"test:integration": "mocha -r ts-node/register -r integrationTests/mochaRootHooks.ts",
|
||||||
"tests:unit": "mocha -R progress -r ts-node/register ./tests/**/*.spec.ts",
|
"tests:unit": "mocha -R progress -r ts-node/register ./tests/**/*.spec.ts",
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
cat > dist/cjs/package.json <<!EOF
|
||||||
|
{
|
||||||
|
"type": "commonjs"
|
||||||
|
}
|
||||||
|
!EOF
|
||||||
|
|
||||||
|
cat > dist/mjs/package.json <<!EOF
|
||||||
|
{
|
||||||
|
"type": "module"
|
||||||
|
}
|
||||||
|
!EOF
|
||||||
Reference in New Issue
Block a user