Skip to content
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

Some devDependencies should be full-fledged dependencies ? #8

Closed
NickCrews opened this issue Jul 7, 2021 · 5 comments
Closed

Some devDependencies should be full-fledged dependencies ? #8

NickCrews opened this issue Jul 7, 2021 · 5 comments

Comments

@NickCrews
Copy link

Hi! Thanks for this library. I'm using it in my personal website and this is quite helpful.

I'm not a NPM/js/etc expert, but I believe that many of the devDependencies you have listed in package.json should actually be dependencies, since you use them in index.js. I discovered this when I recently added the depcheck package to my website as a linting check, and it told me that I wasn't using the rehype package that I had listed as one of my dev dependencies. So, following its advice, I did yarn remove rehype, rebuilt my website, and got:

Error: Cannot find module 'rehype'
Require stack:
- /Users/nickcrews/Documents/projects/blahg/node_modules/mdx-prism/index.js
- /Users/nickcrews/Documents/projects/blahg/.next/server/pages/blog.js
...

If I understand correctly, before I was getting lucky because although mdx-prism wasn't installing rehype for itself, it was able to traverse up the node_modules/ tree and find the rehype that was installed for my website.

So I think really all of the includes in index.js should be moved from dev to normal dependencies. I can submit a PR if you want.

@NickCrews
Copy link
Author

There's a PR that I think fixes this.

@NickCrews
Copy link
Author

Also I found that the depcheck linter would catch this problem. When I run that on your broken main branch it says

nickcrews@Nicks-MBP mdx-prism % npx depcheck --ignores=husky
Missing dependencies
* unified: ./index.js
* rehype-parse: ./index.js

After that PR then depcheck passes

@juanbzpy
Copy link
Owner

closed by #9

@NickCrews
Copy link
Author

Sweet, thanks! Any idea when you'll release v0.3.4 (that has this fix) to npmjs.com?

@NickCrews
Copy link
Author

v0.3.4 is released on https://www.npmjs.com/package/mdx-prism

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants