Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bright-lynxes-import.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lynx-js/react-use": patch
---

Publish an ESM-only package and remove the CommonJS entry point.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
"default": "./dist/index.js"
}
},
"main": "./dist/index.cjs",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
Expand Down
4 changes: 0 additions & 4 deletions rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ export default defineConfig({
bundle: false,
dts: true,
},
{
format: "cjs",
syntax: ["node 18"],
},
],
source: {
tsconfigPath: "./tsconfig.build.json",
Expand Down
5 changes: 4 additions & 1 deletion scripts/test-tree-shaking.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const packageRoot = path.resolve(
"..",
);
await access(path.join(packageRoot, "dist/useTouchEmulation.js"));
await assert.rejects(access(path.join(packageRoot, "dist/index.cjs")), {
code: "ENOENT",
});

const temporaryRoot = await mkdtemp(
path.join(tmpdir(), "reactlynx-use-tree-shaking-"),
Expand Down Expand Up @@ -45,7 +48,7 @@ try {
},
resolve: {
alias: {
"@lynx-js/react-use$": path.join(packageRoot, "dist/index.js"),
"@lynx-js/react-use$": packageRoot,
},
},
});
Expand Down
Loading