-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add support for project references #139
Comments
Also related to #112 |
I just made a big effort to get to rollup/bundle based output on our internal projects (instead of exploded output) and ran into this. Is there any guidance on where the gap is to get project references supported? I'd like to help but unsure if it will take me a lot of time to ramp up on this plugin or rollup internals. |
@rosskevin I haven't looked at what would be involved, with any luck changes should be fairly limited (unless complicated by decisions like if projects should be all rolled into one bundle or split up, etc). If you can make a small example repo that is using project references that will help a lot. |
I had made a very small repo to try out project references with typescript and now I've added a new branch with rollup configured to bundle the typescript files using rollup-plugin-typescript2. https://github.com/thdk/TS3-projects-references-example/tree/es-rollup-typescript Would that be of any help? |
@thdk you aren't using @ezolenko Here is a repo setup based on Ryan Cavanaugh's original sample with project references according to the reference docs: https://github.com/rosskevin/learn-a/tree/build-rollup It is also setup in a common lerna monorepo structure using yarn workspaces. Currently I'll try this now in my more complex internal repo and see if there are more complications. |
So it appears that with the same setup from the For example, rpt2 yields:
which is solved with and part of my base tsconfig: Is tsconfig extension (I have two levels of extension) unsupported? EDIT: I switched to a single level of extension and get the same error |
@rosskevin composite need to be set only for the referenced projects
https://www.typescriptlang.org/docs/handbook/project-references.html Note that my repo only contains a very simple example using only typescript files with no other dependencies in the referenced projects. I'll try to add some more complexity to allow to test more features of rollup-plugin-typescript2 with project references. |
@thdk I made both examples in TS3-projects-references-example work, for project-b you'll need to build common-with-dist before running rollup though. |
@rosskevin tsconfig extension should work, but there might be bugs propagating the options. Try increasing plugin verbosity to 4 and check if the option shows up in parsed tsconfig (look for |
@ezolenko I know it works when I build project common-with-dist before running rollup, but coudn't the common project be detected and be build when required? |
@thdk Maybe it could, but it feels like an overreach to launch independent tsc compilations from rollup. Workaround for now is to add referenced project build step as a dependency or a pre-build in whatever build system starts rollup itself. Or to use direct imports like in |
Partial support is in 0.20.0 now. |
What does it mean partial? I'm trying to use this feature in a monorepo and I don't get my referenced package rebuilt when I add the option in the plugin conf or in my tsconfig... typescript({ build: true }), ...
"compilerOptions": {
"declaration": true,
"declarationDir": "./dist",
"module": "es6",
"noImplicitAny": true,
"strict": true,
"outDir": "./dist",
"target": "es6",
"sourceMap": true,
"build": true
}, Composite flag is on in my referenced package and running Am I missing something? |
What happens and why it is wrong
Since typescript 3.0, typescript has added support for project references.
tsc -b
now build all projects listed in references section of the main tsconfig before the main project is built. See typescript documentation for project references.When using rollup-plugin-typescript2, the references projects are not being build at all. It only builds the current project.
Environment
Versions
rollup.config.js
Not relevant
tsconfig.json
Main project:
Common project
package.json
Not relevant
plugin output with verbosity 3
Not relevant
The text was updated successfully, but these errors were encountered: