FormidableLabs / prism-react-renderer

🖌️ Renders highlighted Prism output to React (+ theming & vendored Prism)
MIT License
1.88k stars 153 forks source link

Themes and other folders not included after npm install #222

Closed angeloluidens closed 1 year ago

angeloluidens commented 1 year ago

I have used several methods to get the package to install with all its dependencies, however, for example, the following statements in my tsx code:

import darkTheme from 'prism-react-renderer/themes/nightOwl' import lightTheme from 'prism-react-renderer/themes/nightOwlLight'

render the following error statement: Cannot find module 'prism-react-renderer/themes/nightOwl' or its corresponding type declarations.ts(2307).

My package.json for the project shows version 2.0.6 of prism-react-renderer. I am using Nodejs version: 12.22.12 Nextjs verision: 13.4.19 NPM version: 9.8.1

Upon inspecting the node_modules/prism-react-renderer folder, only the following are present: dist index.d.ts index.js index.js.map index.mjs node_modules / clsx dist clsx.m.js clsx.min.js clsx.d.ts license package.json readme.md

Please, advice at your earliest!

Thank you in advance.

angeloluidens commented 1 year ago

I have reverted to version 1.3.5 (uninstall version 2.0.6 and did a "npm i prism-react-renderer@1.3.5").

This worked, and the dependencies are listed as expected under node_module/prism-react-renderer.

carloskelly13 commented 1 year ago

Hi :wave: These are now exported as part of the package rather than having to do a path based import.

import { themes } from "prism-react-renderer"

themes will have everything from → https://github.com/FormidableLabs/prism-react-renderer/blob/master/packages/prism-react-renderer/src/themes/index.ts