Skip to content

Commit 4eae451

Browse files
fix: export correct build files (#232)
Co-authored-by: Andreas Karlsson <[email protected]>
1 parent 00e6b7a commit 4eae451

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

packages/openfeature-server-provider/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
},
3737
"exports": {
3838
".": {
39-
"import": "./build/index.mjs",
40-
"require": "./build/index.cjs",
39+
"import": "./build/index.js",
4140
"types": "./build/index.d.ts"
4241
}
4342
}

packages/openfeature-web-provider/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
},
4040
"exports": {
4141
".": {
42-
"import": "./build/index.mjs",
43-
"require": "./build/index.cjs",
42+
"import": "./build/index.js",
4443
"types": "./build/index.d.ts"
4544
}
4645
}

packages/react/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
},
2828
"exports": {
2929
".": {
30-
"import": "./build/index.mjs",
31-
"require": "./build/index.cjs",
30+
"import": "./build/index.js",
3231
"types": "./build/index.d.ts"
3332
}
3433
},

packages/sdk/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
"type": "module",
4242
"exports": {
4343
".": {
44-
"import": "./build/index.mjs",
45-
"require": "./build/index.cjs",
44+
"import": "./build/index.js",
4645
"types": "./build/index.d.ts"
4746
}
4847
}

yarn.config.cjs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,35 @@ module.exports = defineConfig({
8181
});
8282

8383
function configureExports(workspace, map) {
84-
workspace.set('exports', buildExports(map, 'build'));
84+
workspace.set('exports', buildExports(map));
8585
workspace.set('publishConfig', {
8686
registry: 'https://registry.npmjs.org/',
8787
access: 'public',
88-
exports: buildExports(map, 'dist'),
88+
exports: distExports(map),
8989
});
9090
}
9191

92-
function buildExports(map, prefix) {
92+
function buildExports(map) {
9393
return Object.fromEntries(
9494
Object.entries(map).map(([key, value]) => {
9595
if (typeof value === 'string') {
9696
value = {
97-
import: `./${prefix}/${value}.mjs`,
98-
require: `./${prefix}/${value}.cjs`,
99-
types: `./${prefix}/${value}.d.ts`,
97+
import: `./build/${value}.js`,
98+
types: `./build/${value}.d.ts`,
99+
};
100+
}
101+
return [key, value];
102+
}),
103+
);
104+
}
105+
function distExports(map) {
106+
return Object.fromEntries(
107+
Object.entries(map).map(([key, value]) => {
108+
if (typeof value === 'string') {
109+
value = {
110+
import: `./dist/${value}.mjs`,
111+
require: `./dist/${value}.cjs`,
112+
types: `./dist/${value}.d.ts`,
100113
};
101114
}
102115
return [key, value];

0 commit comments

Comments
 (0)