Skip to content

Commit

Permalink
chore: Use ESM in dev (#42)
Browse files Browse the repository at this point in the history
* chore: Use ESM in dev

* Revert module type

* Use relative path
  • Loading branch information
alexnault authored Apr 12, 2023
1 parent 1f719a2 commit a95bb87
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .size-limit.js → .size-limit.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ module.exports = [
},
{
name: "ESM Minified",
path: "dist/esm/*.js",
path: "dist/esm/*.mjs",
gzip: false,
limit: "134B",
},
{
name: "ESM Compressed",
path: "dist/esm/*.js",
path: "dist/esm/*.mjs",
limit: "107B",
},
];
10 changes: 5 additions & 5 deletions benchmark/index.js → benchmark/index.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const benchmark = require("benchmark");
const classnames = require("classnames");
const { clsx } = require("clsx");
const { cx } = require("classix");
import benchmark from "benchmark";
import classnames from "classnames";
import { clsx } from "clsx";
import { cx } from "classix";

const { cx: cxLocal } = require("../dist/cjs/classix.js");
import { cx as cxLocal } from "../dist/esm/classix.mjs";

new benchmark.Suite()
.add("classnames", () => classnames("class1", true && "class2"))
Expand Down
1 change: 1 addition & 0 deletions jest.config.js → jest.config.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @type {import('jest').Config} */
module.exports = {
preset: "ts-jest",
collectCoverage: true,
Expand Down
16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
"name": "classix",
"version": "1.0.0-semantic-release",
"description": "The fastest and tiniest utility for conditionally joining classNames.",
"main": "dist/cjs/classix.js",
"module": "dist/esm/classix.js",
"types": "dist/classix.d.ts",
"main": "./dist/cjs/classix.js",
"module": "./dist/esm/classix.mjs",
"types": "./dist/classix.d.ts",
"exports": {
".": {
"require": "./dist/cjs/classix.js",
"import": "./dist/esm/classix.mjs",
"types": "./dist/classix.d.ts"
},
"./package.json": "./package.json"
},
"author": "Alex Nault",
"keywords": [
"class",
Expand All @@ -19,7 +27,7 @@
"repository": "https://github.com/alexnault/classix",
"homepage": "https://github.com/alexnault/classix#readme",
"scripts": {
"bench": "node benchmark",
"bench": "node benchmark/index.mjs",
"build": "rm -rf ./dist && rollup -c",
"format": "prettier --write \"{src,benchmark}/**/*.{js,ts}\"",
"lint": "eslint src/ --max-warnings=0",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js → rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default [
strict: false, // Don't emit "use strict" in output
},
{
file: `dist/esm/classix.js`,
file: `dist/esm/classix.mjs`,
format: "es",
},
],
Expand Down

0 comments on commit a95bb87

Please sign in to comment.