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: don't attempt to change declarationMap sources when no output #334

Merged
merged 1 commit into from
Jun 1, 2022

Conversation

agilgur5
Copy link
Collaborator

Summary

Skip transforming declarationMap sources when there is no output, i.e. in the case of using rpt2 as a configPlugin

Details

  • when using rpt2 as a configPlugin, there is no Rollup output, so it will be undefined
    • when declarationMap: true in tsconfig, this block of code is called as a workaround due to the placeholder dir we must use for output -- but, in this case, it errors out, since the declarationDir is undefined
      • path.relative needs a string as a arg, not undefined
      • so skip this transformation entirely when there's no output, as it doesn't need to be done in that case anyway
      • this transformation code happens to have been written by me 2 years ago too in (fix): declaration maps should have correct sources #221, so I had fixed one bug with that but created a different bug 😅 (fortunately a smaller one that only I have stumbled upon so far)

@agilgur5 agilgur5 added kind: bug Something isn't working properly kind: regression Specific type of bug -- past behavior that worked is now broken and removed kind: bug Something isn't working properly labels May 31, 2022
- when using rpt2 as a configPlugin, there is no Rollup `output`, so it
  will be `undefined`
  - when `declarationMap: true` in `tsconfig`, this block of code is
    called as a workaround due to the placeholder dir we must use for
    output -- but, in this case, it errors out, since the
    `declarationDir` is `undefined`
    - `path.relative` needs a `string` as a arg, not `undefined`
    - so skip this transformation entirely when there's no `output`, as
      it doesn't need to be done in that case anyway
    - this transformation code happens to have been written by me 2
      years ago too, so I had fixed one bug with that but created
      a different bug 😅 (fortunately one that only I have stumbled upon)
@agilgur5 agilgur5 force-pushed the fix-configplugin-usage branch from 8448f32 to 3a9c951 Compare June 1, 2022 17:58
@agilgur5
Copy link
Collaborator Author

agilgur5 commented Jun 1, 2022

Fixed the merge conflicts with #335 so this is ready for review/merge now @ezolenko

@ezolenko ezolenko merged commit ccd6815 into ezolenko:master Jun 1, 2022
@agilgur5 agilgur5 added the scope: configPlugin Related to usage as a configPlugin for reading rollup.config.ts (vs. regular plugin) label Sep 4, 2022
@agilgur5 agilgur5 deleted the fix-configplugin-usage branch July 2, 2023 21:25
@agilgur5 agilgur5 restored the fix-configplugin-usage branch July 2, 2023 21:25
@agilgur5 agilgur5 deleted the fix-configplugin-usage branch July 7, 2023 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: regression Specific type of bug -- past behavior that worked is now broken scope: configPlugin Related to usage as a configPlugin for reading rollup.config.ts (vs. regular plugin)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Runtime error when using as configPlugin with "declarationMap": true
2 participants