Skip to content

Commit 2fed2aa

Browse files
committed
fix: Fix common package to work with node16 module resolution.
1 parent dee53af commit 2fed2aa

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

packages/shared/common/package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "@launchdarkly/js-sdk-common",
33
"version": "2.10.0",
44
"type": "module",
5-
"main": "./dist/index.mjs",
6-
"types": "./dist/index.d.ts",
5+
"main": "./dist/esm/index.mjs",
6+
"types": "./dist/esm/index.d.ts",
77
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/shared/common",
88
"repository": {
99
"type": "git",
@@ -19,13 +19,15 @@
1919
"client"
2020
],
2121
"exports": {
22-
"types": "./dist/index.d.ts",
23-
"require": "./dist/index.cjs",
24-
"import": "./dist/index.mjs"
22+
"require": { "types": "./dist/cjs/index.d.ts", "default": "./dist/cjs/index.cjs"},
23+
"import": { "types": "./dist/esm/index.d.ts", "default": "./dist/esm/index.mjs"}
2524
},
2625
"scripts": {
2726
"test": "npx jest --ci",
28-
"build": "npx tsc --noEmit && rollup -c rollup.config.js",
27+
"make-cjs-package-json": "echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
28+
"make-esm-package-json": "echo '{\"type\":\"module\"}' > dist/esm/package.json",
29+
"make-package-jsons": "npm run make-cjs-package-json && npm run make-esm-package-json",
30+
"build": "npx tsc --noEmit && rollup -c rollup.config.js && npm run make-package-jsons",
2931
"clean": "rimraf dist",
3032
"lint": "npx eslint . --ext .ts",
3133
"lint:fix": "yarn run lint --fix",

packages/shared/common/rollup.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const getSharedConfig = (format, file) => ({
2020

2121
export default [
2222
{
23-
...getSharedConfig('es', 'dist/index.mjs'),
23+
...getSharedConfig('es', 'dist/esm/index.mjs'),
2424
plugins: [
2525
typescript({
2626
module: 'esnext',
@@ -35,7 +35,7 @@ export default [
3535
],
3636
},
3737
{
38-
...getSharedConfig('cjs', 'dist/index.cjs'),
39-
plugins: [typescript({ tsconfig: './tsconfig.json' }), common(), json()],
38+
...getSharedConfig('cjs', 'dist/cjs/index.cjs'),
39+
plugins: [typescript({ tsconfig: './tsconfig.json', outputToFilesystem: true, }), common(), json()],
4040
},
4141
];

packages/shared/common/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
"sourceMap": true,
1414
"declaration": true,
1515
"declarationMap": true, // enables importers to jump to source
16-
"stripInternal": true,
17-
"composite": true
16+
"stripInternal": true
1817
},
1918
"include": ["src"],
2019
"exclude": ["**/*.test.ts", "dist", "node_modules", "__tests__"]

packages/shared/sdk-client/src/DataManager.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
ProcessStreamResponse,
1010
subsystem,
1111
} from '@launchdarkly/js-sdk-common';
12-
import { LDStreamProcessor } from '@launchdarkly/js-sdk-common/dist/api/subsystem';
1312

1413
import { LDIdentifyOptions } from './api/LDIdentifyOptions';
1514
import { Configuration } from './configuration/Configuration';
@@ -203,9 +202,9 @@ export abstract class BaseDataManager implements DataManager {
203202
}
204203

205204
private _decorateProcessorWithStatusReporting(
206-
processor: LDStreamProcessor,
205+
processor: subsystem.LDStreamProcessor,
207206
statusManager: DataSourceStatusManager,
208-
): LDStreamProcessor {
207+
): subsystem.LDStreamProcessor {
209208
return {
210209
start: () => {
211210
// update status before starting processor to ensure potential errors are reported after initializing

0 commit comments

Comments
 (0)