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: point alias to build/ instead of src/ #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

agilgur5
Copy link

@agilgur5 agilgur5 commented Jul 9, 2023

Summary

Fixes ezolenko/rollup-plugin-typescript2#454

Details

  • this makes rpt2 have the same output as tsc for the sdk package

    • outputs to mirrored directory structure of src, w/ actions/create.* and models/user.* - implicit rootDir of packages/sdk/src, same as tsc
  • mark @shared as an external in Rollup config

    • removes warning about it being treated as external

Misc Changes

  • add a clean command to help with debugging

  • add clean and verbosity options to rpt2 to help with debugging / tracing

    • remove commented options that are not valid rpt2 options

- this makes rpt2 have the same output as `tsc` for the `sdk` package
  - outputs to mirrored directory structure of `src`, w/ `actions/create.*` and `models/user.*`
    - implicit `rootDir` of `packages/sdk/src`, same as `tsc`

- mark `@shared` as an `external` in Rollup config
  - removes warning about it being treated as external

- add a `clean` command to help with debugging

- add `clean` and `verbosity` options to rpt2 to help with debugging / tracing
  - remove commented options that are not valid rpt2 options
@lavcraft
Copy link
Owner

lavcraft commented Jul 10, 2023

@agilgur5 thanks for verbose and clean options. But it's not what i want in my case, because:

  1. when changing paths.@shared from src to build — project reference stop works. According to this, i need to run dev mode for each related project for building it independently (may be via conccurent run). Wan't to avoid this, because it very flaky and not reliable :(
  2. I need to build my SDK and include @shared package, not mark it as external :) My logic - bunch of internal projects with some relationship. One of this project is SDK, – it will consumed in internal project as builded dependency via npm workspace. Internal @shared project used in many internal project, and include during build by rollup into resulted sdk package.
  3. Default tsc output doesn't contain prebuilded @shared (must be inlined) - but i want and also use rollup for this purposes (in js and d.ts)

@agilgur5
Copy link
Author

agilgur5 commented Jul 11, 2023

  1. when changing paths.@shared from src to build — project reference stop works.

So the project reference continued working for me when I changed this. tsc -b / npm run -w @project/sdk build still worked for me. As the reference itself was not changed, only the paths alias.

You could also use @rollup/plugin-alias to have it be build for Rollup, while tsc continues to use src

3. Default tsc output doesn't contain prebuilded @shared (must be inlined) - but i want and also use rollup for this purposes (in js and d.ts)

Ok, yea this is what I asked about in the issue. rpt2 tries to mimic tsc as closely as possible, so that seems like correct behavior to me.
Otherwise, the behavior prior to this PR does in-line both, just not in the directory structure you expected. That directory structure is correct though, as it is the common root between the two packages.

It might be easier to achieve what you're looking for by using npm link on @shared, as it will act as a separate package to all of Node then (not limited to tsc). It will use the output (as intended) and then Rollup could in-line that.

Also as @shared is in-lined, its typings are internal now and so aren't exported from sdk

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

Successfully merging this pull request may close these issues.

Typings directory when in-lining project references
2 participants