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

fix(webpack): allow transpiling package in nested node_modules #8205

Merged
merged 1 commit into from
Nov 30, 2020
Merged

fix(webpack): allow transpiling package in nested node_modules #8205

merged 1 commit into from
Nov 30, 2020

Conversation

padinko
Copy link

@padinko padinko commented Oct 14, 2020

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

When I need to transpile [PROJECT_PATH]/node_modules/lowlight/node_modules/highlight.js/... but not transpile /lowlight/ itself, it is imposible, because split only return text between node_modules ( /lowlight/ in this example)

this change leave full path after first node_modules, not only path between 2 node_modules ( /lowlight/node_modules/highlight.js/... in this example)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)
  • All new and existing tests are passing.

When I need to transpile `/lowlight/node_modules/highlight.js/...` but not transpile `/lowlight/` itself, it is imposible, because split only return text between `node_modules` ( `/lowlight/` in this example)

this change leave full path after first `node_modules`, not only path between 2 `node_modules`
@pi0 pi0 changed the title Allow transpiling package in nested node_modules fix(webpack): allow transpiling package in nested node_modules Oct 14, 2020
@pi0 pi0 requested a review from clarkdo October 14, 2020 13:13
Copy link
Member

@clarkdo clarkdo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change look OK.

But I think we need to consider it this is a proper fix in your scenario, I think a bigger issue from your description is: your app is having inconsistent version of highlight.js, so highlight.js is installed under lowlight/node_modules.

I suggest adding highlight.js to dependencies explicitly and remove inconsistent version, then highlight.js will be installled under node_modules

@padinko
Copy link
Author

padinko commented Oct 14, 2020

@clarkdo
Hi, for me it is imposible to have highlight not nested:

  • @vue/cli-service required cli-highlight which requires highlight.js@9
  • tiptap-extensions requires lowlight which requires highlight.js@10

we need both this packages, and they are not using same version, so npm install one of them to nested node_modules (standard behavior)

@clarkdo
Copy link
Member

clarkdo commented Oct 14, 2020

for me it is imposible to have highlight not nested:

Sorry, what I mean is we should always add dependencies explicitly.

Like your case, if you're using highlight.js v9 in you app pages, you should have it in dependencies, and it will be hoisted to root node_modules, @vue/cli-service will also work as its dependencies will be nested but you won't use it in your app pages or components.

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change seems good. Still it is highly recommended to explicitly include dependencies in package.json. Since there is no proper reproduction, if it makes regressions we may need to revert in a patch.

@pi0 pi0 changed the title fix(webpack): allow transpiling package in nested node_modules fix(webpack): allow transpiling package in nested node_modules Nov 30, 2020
@pi0 pi0 merged commit da38f96 into nuxt:dev Nov 30, 2020
@pi0 pi0 mentioned this pull request Nov 30, 2020
OsvaldoRino added a commit to OsvaldoRino/nuxt.js that referenced this pull request Jan 4, 2023
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants