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

Do not assume node_modules path #449

Open
Tronix117 opened this issue Apr 13, 2023 · 3 comments
Open

Do not assume node_modules path #449

Tronix117 opened this issue Apr 13, 2023 · 3 comments

Comments

@Tronix117
Copy link

In the following file, it assumes the structure is always known and always the same.
It's not always the case, for exemple using pnpm, you have a slightly different node_modules structure

module.exports.highlightThemePath = path.resolve(require.resolve('highlight.js'), '..', '..', 'styles');

@webpro
Copy link
Owner

webpro commented Apr 24, 2024

It's not pretty, but I don't see how this could be different across package managers? This is navigating within a single package.

@webpro webpro closed this as completed Apr 24, 2024
@Tronix117
Copy link
Author

Hello, no it's not, you go up the directories from the highlightjs package location, to get back to the root folder. When we use some other package manager like pnpm or yarn with the plug'n'play mode or non default npm mode,
you'll see the structure is quite different and this code does not work out of the box.

You can try by:

  • removing node_module directory
  • installing pnpm (like with npm i -g pnpm)
  • running pnpm i

@webpro
Copy link
Owner

webpro commented Apr 24, 2024

Ah yes, PnP. PR is welcome :)

@webpro webpro reopened this Apr 24, 2024
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