Skip to content

Commit

Permalink
feat: make package esm only
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdoro committed Jan 18, 2025
1 parent 0e8a8a8 commit 9d83b94
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
6 changes: 6 additions & 0 deletions packages/headless/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# [0.2.0](https://github.com/steven-tey/novel/compare/v0.1.0...v0.2.0) (2025-01-17)

## 1.0.1

### Patch Changes

- remote tiptap markdown

## 1.0.0

### Major Changes
Expand Down
9 changes: 9 additions & 0 deletions packages/headless/esm-only.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// ESM only manifesto: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

// This stub file was added to let some old ESLint plugins resolve
// the import paths correctly, as setting exports.*.require: null in package.json didn't work.

throw new Error(
`This package is ESM only.
See https://err.47ng.com/NUQS-101 for more details.`,
);
15 changes: 12 additions & 3 deletions packages/headless/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
{
"name": "novel",
"version": "1.0.0",
"version": "1.0.1",
"description": "Notion-style WYSIWYG editor with AI-powered autocompletions",
"license": "Apache-2.0",
"type": "module",
"main": "dist/index.cjs",
"sideEffects": false,
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./esm-only.cjs"
}
},
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"dev": "tsup --watch",
"typecheck": "tsc --noEmit",
"build": "tsup",
"lint": "biome lint ./src",
"format": "biome format ./src "
},
"sideEffects": false,
"peerDependencies": {
"react": ">=18"
},
Expand Down
4 changes: 3 additions & 1 deletion packages/headless/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ export default defineConfig((options: Options) => ({
js: "'use client'",
},
minify: true,
format: ["cjs", "esm"],
format: ["esm"],
dts: true,
clean: true,
external: ["react", "react-dom"],
splitting: true,
treeshake: true,
...options,
}));

0 comments on commit 9d83b94

Please sign in to comment.