Skip to content

Commit 0fa2241

Browse files
authored
Merge pull request #557 from thebuilder/feat/microbundle-update
2 parents 3d4534e + bc0daf6 commit 0fa2241

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

package.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
"name": "react-intersection-observer",
33
"version": "8.26.1",
44
"description": "Monitor if a component is inside the viewport, using IntersectionObserver API",
5-
"source": "src/index.tsx",
6-
"main": "dist/react-intersection-observer.js",
7-
"module": "dist/react-intersection-observer.m.js",
8-
"unpkg": "dist/react-intersection-observer.umd.js",
9-
"typings": "dist/index.d.ts",
5+
"source": "./src/index.tsx",
6+
"main": "./dist/react-intersection-observer.js",
7+
"module": "./dist/react-intersection-observer.mjs",
8+
"exports": {
9+
"require": "./dist/react-intersection-observer.js",
10+
"default": "./dist/react-intersection-observer.modern.mjs"
11+
},
12+
"unpkg": "./dist/react-intersection-observer.umd.js",
13+
"typings": "./dist/index.d.ts",
1014
"author": "Daniel Schmidt",
1115
"sideEffects": false,
1216
"repository": {
@@ -89,19 +93,19 @@
8993
},
9094
"size-limit": [
9195
{
92-
"path": "dist/react-intersection-observer.m.js",
96+
"path": "dist/react-intersection-observer.mjs",
9397
"name": "InView",
9498
"import": "{ InView }",
9599
"limit": "1.8 kB"
96100
},
97101
{
98-
"path": "dist/react-intersection-observer.m.js",
102+
"path": "dist/react-intersection-observer.mjs",
99103
"name": "useInView",
100104
"import": "{ useInView }",
101105
"limit": "1.3 kB"
102106
},
103107
{
104-
"path": "dist/react-intersection-observer.m.js",
108+
"path": "dist/react-intersection-observer.mjs",
105109
"name": "observe",
106110
"import": "{ observe }",
107111
"limit": "1 kB"

scripts/build-copy.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,25 @@ packageFieldsToRemove.forEach((field) => {
2929
});
3030

3131
// Remove 'dist' from the files inside the 'dist' dir, after we move them
32-
const fields = ['main', 'module', 'unpkg', 'esmodule', 'exports', 'typings'];
33-
fields.forEach((key) => (pck[key] = pck[key]?.replace('dist/', '')));
32+
const fields = [
33+
'main',
34+
'module',
35+
'unpkg',
36+
'exports',
37+
'esmodule',
38+
'exports',
39+
'typings',
40+
];
41+
fields.forEach((key) => {
42+
if (typeof pck[key] === 'object') {
43+
const keys = Object.keys(pck[key]);
44+
keys.forEach((subkey) => {
45+
pck[key][subkey] = pck[key][subkey]?.replace('./dist/', './');
46+
});
47+
} else {
48+
pck[key] = pck[key]?.replace('./dist/', './');
49+
}
50+
});
3451

3552
fs.writeFileSync(
3653
path.resolve(distDir, 'package.json'),

0 commit comments

Comments
 (0)