-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERR_PACKAGE_PATH_NOT_EXPORTED when attempting to import #6
Comments
So it's throwing when you try to do this: Also, what OS are you using? And can you share any more of the error output? |
I'm closing this issue, due to no response after two weeks. I can open it back up if needed. |
Using OSX, and yes I tried a few variations, but started with |
I'll give it a try this weekend. |
@folklorelabs I'm not familiar with React, Next (if you're using that?) and tsx, but I did my best using Aside from that, I'm using Node 20.10.0 and npm 10.2.5, but I had no errors for the import and prettify worked as expected. I tried this on an Ubuntu machine with WSL. |
import type { Metadata } from "next";
import localFont from "next/font/local";
import "./globals.css";
import { prettify } from "htmlfy";
import React from "react";
console.log(prettify('<div><p>hello</p><p>world</p></div>'))
const geistSans = localFont({
src: "./fonts/GeistVF.woff",
variable: "--font-geist-sans",
weight: "100 900",
});
const geistMono = localFont({
src: "./fonts/GeistMonoVF.woff",
variable: "--font-geist-mono",
weight: "100 900",
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className={`${geistSans.variable} ${geistMono.variable}`}>
{children}
</body>
</html>
);
} {
"compilerOptions": {
"jsx": "preserve",
"lib": [
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"incremental": true,
"plugins": [
{
"name": "next"
}
]
},
"include": [
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules",
"scripts"
]
}
|
Ah, I hate these library names haha. I'm fairly certain this is the conflict/root of the problem. For more app context:
|
So if I do something like this, where script.ts is importing prettify, it should show the issue? |
I was able to reproduce the issue. |
@folklorelabs I was able to resolve by adding Do you have that field in yours? |
Essentially, htmlfy is an ESM-only library. |
Ah gotcha okay! I think I have another conflicting library preventing that from working, but I will give that a shot! Maybe I can set that and then resolve my other library issues. Thanks for looking into this! |
I actually just realized that I might just need one more line in my package.json and you should be good. Try installing the latest version, 0.3.0 |
That works! 🙌 |
Awesome. After all of that, I hope it meets your needs! |
Definitely! We have a pretty janky pipeline and I'm excited to clean up the markup as part of that. Thanks again for the help and the library :D |
Hi -- been trying to find a decent html prettifier and stumbled upon your lib. Unfortunately I'm not able to import due to a
ERR_PACKAGE_PATH_NOT_EXPORTED
error.Some extra context:
v18.20.2
and npmv10.5.0
package.json
after installing so it's an odd callout/error. Also no eslint errors (it's usually very good about this sort of thing).tsx
in particular) with the following tsconfig:The text was updated successfully, but these errors were encountered: