nicojs / typed-html

TypeSafe HTML templates using TypeScript. No need to learn a template library.
333 stars 51 forks source link

The package.json file has a bad "module" path. #43

Open mat813 opened 1 year ago

mat813 commented 1 year ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch typed-html@3.0.1 for the project I'm working on.

When running vite to build, I got this error from esbuild :

[commonjs--resolver] Failed to resolve entry for package "typed-html". The package may have incorrect main/module/exports specified in its package.json.

This is because the module line does not have the correct path in package.json.

Here is the diff that solved my problem:

diff --git a/node_modules/typed-html/package.json b/node_modules/typed-html/package.json
index cd4e..beab 100644
--- a/node_modules/typed-html/package.json
+++ b/node_modules/typed-html/package.json
@@ -3,7 +3,7 @@
   "version": "3.0.1",
   "description": "TypeSafe HTML templates using TypeScript. No need to learn a template library.",
   "main": "dist/src/elements.js",
-  "module": "dist/esm/elements.js",
+  "module": "dist/esm/src/elements.js",
   "repository": {
     "type": "git",
     "url": "https://github.com/nicojs/typed-html"

This issue body was partially generated by patch-package.

arthurfiorette commented 1 year ago

@mat813 @kitajs/html does not have this same problem :)