-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
feat(Provide better API and Exposure to compiler-cli codegen and transpile) #8759
Comments
@s-panferov @jbrantly I'd love to not fork and implement something like this from your repo's, do you think when this issue is implemented we could talk about incorporating a plugin into your typescript loaders that incorporate the extra angular offline compiler functionality? |
@TheLarkInn I've already had some thoughts about code-gen plugin support, so I definitely approve an idea to add some external plugin support. Feel free to create a corresponding issue in awesome-typescript-loader issue tracker. |
@tbosch here's a rough example of what I'm referring to: |
This allows angular's build to depend on some extensions, but not on code generation, and breaks a cycle in the angular build We now merge ts-metadata-collector into tsc-wrapped and stop publishing the former.
@alexeagle can you please chime in with your plans to provide incremental compilation story? |
As discussed elsewhere, we're confident that I am switching back to google-internal work right now, so I won't have time to add the |
I can take a stab at a PR. Are we against the feature as an idea? Or is it a matter of not being a priority to implement. |
We're not against On Mon, Jun 13, 2016 at 10:12 AM Sean Larkin notifications@github.com
|
@alexeagle @chuckjaz I'm fine with that. Watch mode looks easy enough to implement. But referencing here: function directoryChangeHandler() {
const parsedCommandLine = parseConfigFile();
const newFileNames = ts.map(parsedCommandLine.fileNames, compilerHost.getCanonicalFileName);
const canonicalRootFileNames = ts.map(rootFileNames, compilerHost.getCanonicalFileName);
// We check if the project file list has changed. If so, we just throw away the old program and start fresh.
if (!arrayIsEqualTo(newFileNames && newFileNames.sort(), canonicalRootFileNames && canonicalRootFileNames.sort())) {
setCachedProgram(undefined);
startTimerForRecompilation();
}
} If I read this correctly, (and then the code it calls), it looks like when files are changed, that there isn't even CompilerHost based incremental support. (Please correct me if I'm wrong). So users of a very scaled angular application would see slow build times, (even in watch mode). Almost like trying to compile the |
I think that code is handling the case that your list of files[] in On Mon, Jun 13, 2016 at 3:39 PM Sean Larkin notifications@github.com
|
Wanted to check up on this. Currently blocking our prototyping for our migration for ng2, so anxious to see progress here! |
We need offline compilation with webpack. My angular2 bundle is getting too large, almost 8MB for all the polyfills, angular2 stuff, compiler stuff. Of that 8MB, only 600kb is my actually "app" code. Offline compilation would dramatically shrink my bundle size down, and make the app load way faster. |
It's important to note it's possible by webpack 'ing the result of AoT compiler, the goal of this issue is to provide a direct webpack experience without having extra files in source, etc. The right webpack experience |
Actually there has been discussion elsewhere of the affect of precompilation on overall deployed code size. Summary:
|
Could you link that here in your comment @kylecordes. Just for reference. And also, are you implying that webpack as a direct integration can help mitigate this? |
@TheLarkInn It is discussed in #10812. |
@robwormald Could you add a link of your integration of AoT with webpack here? |
@tbosch I took a look at it last night. I'd like to leave this issue open for now until we get it finalized. |
+1 to this, our project is large and we had to go back to not using ngc during dev mode but now we waste a ton of time running builds to check if ngc still works. We should be able to just use it in both dev mode and build mode. |
@alexeagle webpack plugin is already available so I believe it can be closed |
The underlying issue with incremental compilation and diagnostics rooted in TS is not. But the AoT plugin does exist now. Having incremental compilation would severely enhance the AoT story but as of now there is something that works |
@tbosch is considering a true watch mode for |
@DzmitryShylovich What is the name of the webpack plugin you are referring to? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I have been charged with the task of writing a webpack loader for the CompilerCLI's offline compilation a code generation feature.
Because the compiler-cli was written as a one off 'build step', it implements
ts.CompilerHost
. This however poses a problem for Lifetime transpilation tools like a webpack loader. If you look at the source code in bothts-loader
andawesome-typescript-loader
you'll notice that both of these implementts.LanguageServiceHost
. Although these two interfaces overlap, piping ats.LanguageServiceHost
is not a plug-and-play solution: TheLarkInn/awesome-typescript-loader@7b21b13Proposal
ts.CompilerHost
to assist in finding and reading files is obsolete/not needed.TsickleHost
,Codegenerator
,ReflectionHost
,MetadataHost
) to accept and incorporatets.LanguageServiceHost
.The text was updated successfully, but these errors were encountered: