Skip to content

Commit 73fe391

Browse files
committed
fix: make config package cjs-only (#755)
* fix: make sure config is singleton
1 parent 7148e24 commit 73fe391

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

packages/config/package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
"name": "@kiltprotocol/config",
33
"version": "0.32.0",
44
"description": "",
5-
"main": "./lib/cjs/index.js",
6-
"module": "./lib/esm/index.js",
7-
"types": "./lib/cjs/index.d.ts",
5+
"type": "commonjs",
6+
"main": "./lib/index.js",
7+
"module": "./lib/index.mjs",
8+
"types": "./lib/index.d.ts",
89
"exports": {
910
".": {
10-
"import": "./lib/esm/index.js",
11-
"require": "./lib/cjs/index.js"
11+
"import": "./lib/index.mjs",
12+
"require": "./lib/index.js",
13+
"types": "./lib/index.d.ts"
1214
}
1315
},
1416
"files": [
@@ -18,8 +20,8 @@
1820
"clean": "rimraf ./lib",
1921
"build": "yarn clean && yarn build:ts",
2022
"build:ts": "yarn build:cjs && yarn build:esm",
21-
"build:cjs": "tsc --declaration -p tsconfig.build.json && echo '{\"type\":\"commonjs\"}' > ./lib/cjs/package.json",
22-
"build:esm": "tsc --declaration -p tsconfig.esm.json && echo '{\"type\":\"module\"}' > ./lib/esm/package.json"
23+
"build:cjs": "tsc --declaration -p tsconfig.build.json",
24+
"build:esm": "tsc --declaration -p tsconfig.esm.json && yarn exec cp -f ./lib/esm/index.js ./lib/index.mjs && rimraf ./lib/esm"
2325
},
2426
"repository": "github:kiltprotocol/sdk-js",
2527
"engines": {

packages/config/tsconfig.build.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
"compilerOptions": {
55
"module": "CommonJS",
6-
"outDir": "./lib/cjs"
6+
"outDir": "./lib"
77
},
88

99
"include": [
10-
"src/**/*.ts", "src/**/*.js"
10+
"src/**/*.ts"
1111
],
1212

1313
"exclude": [

0 commit comments

Comments
 (0)