-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Radical (and random) reorganization of output file #3786
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
Comments
The compiler doesn't re-order code at all. One possibility of what's going on is that you're using Can you post more details about your build setup? |
Interesting. Maybe this is specific to building in Visual Studio. I'm using TypeScript 1.5beta and Visual Studio 2015 RC. there's no tsconfig.json. |
In a Visual Studio project, files will be passed to the compiler in the order they appear in the project file. since editing the project file is not that user-friendly, you can add a file To see how VS and the compiler get the files look at the build log (tools\options\projects and solution\Build and Run, then select "MSBuild project build output verbosity" to be "Normal", build and in your output window search for "tsc.exe" ) for more information about ordering see #1066 (comment) |
Thanks! i'll try the _references.ts solution and see how that works. |
So. The _references.ts file works great for ordering but the i don't think this is correct since the code referenced is already included (and this causes havoc for bundling solutions like Cassette that try to resolve those references) |
/// references being preserved or not has always been a back and forth issue as some people had tools that relied on them hanging around, others relied on them not being around (I believe Cassette has been referenced before for this latter case). On the plus side it's easy to remove them manually in a post build step with a regex. |
Interesting. I wonder what the scenario would be for keeping |
Looks like the original issue has been answered. please reactivate if you are running into other issues. |
So, we've moved to using gulp tasks and tsconfig based projects but the order of the concatenated file is still totally random. After dependencies have been resolved, the classes with no dependencies will randomly move around the combined output. We commit the compiled JS to source control and this results in a lot of unnecessary commits. Sometimes a developer will compile, commit a JS file with one ordering, re-compile and get a different ordering. After dependencies have been resolved, could you order classes alphabetically or something to ensure they stay in the roughly the same place in the combined output file? |
The compiler does not order files. If you have a repro project that building it multiple times result in different order we need to look at it. |
@mhegazy I have a project where i can repro this. i'd prefer not to post it here. how can i send you the details? |
|
@mhegazy helped me track down my issue. It was actually caused by gulp streams being randomly ordered. I added the gulp-natural-sort plugin to give consistent ordering and that seems to have solved it. |
We have typescript set to combine output into a single file. we've noticed that, seemingly at random, a very small change in a source file will result in huge changes in the output file resulting from the order of classes being totally reorganized.
i realize that the .ts file should be treated as "output" but these massive changes make it difficult to track edits in source control.
Ideally, a tree of dependent classes, ordered alphabetically, would be generated and traversed to combine the output.
The text was updated successfully, but these errors were encountered: