You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When following the example of building a virtual directory using 'rootDirs' in my tsconfig.json file described here I expect the contents /src/views and /generated/templates/views to be combined into a single directory at build. The doc states:
A build step will copy the files in /src/views and /generated/templates/views to the same directory in the output. At run-time, a view can expect its template to exist next to it, and thus should import it using a relative name as "./template".
What actually happens is both folders are copied to the output directory at build, but folder structure is preserved, causing references from one file to the other to be broken.
Expected behavior: The contents of the generated\templates\views and src\views folders are combined into the dist folder.
Actual behavior: Both the generated\templates\views and src\views folders are copied to dist, but folder structure is preserved. The two files do not exist next to each other and references from one file to the other are broken.
A build step will copy the files* in /src/views and /generated/templates/views to the same directory in the output. At run-time, a view can expect its template to exist next to it, and thus should import it using a relative name as "./template".
There is an assumption about this being done at build time.
The whole module resolution strategy for the compiler is it does not really change where modules are, it just tells the compiler where to find them at design time. Moving files is the responsibility of the build system.
I guess my coworker and I misread "A build step will copy the files in /src/views and /generated/templates/views to the same directory in the output." to mean that the typescript complier would automatically handle the merge of the specified folders, that is why I was looking for a combined output in the root of the output folder. Rereading it after your comments I see that it implies that the developer has added a build step to handle the folder merge. Thanks for clearing that up!
Activity
brantw commentedon Jul 21, 2016
Mohamed Hegazy (@mhegazy)
mhegazy commentedon Jul 21, 2016
yes :)
mhegazy commentedon Jul 21, 2016
reading ...
mhegazy commentedon Jul 21, 2016
well.. as noted in the documentation
There is an assumption about this being done at build time.
The whole module resolution strategy for the compiler is it does not really change where modules are, it just tells the compiler where to find them at design time. Moving files is the responsibility of the build system.
brantw commentedon Jul 21, 2016
I guess my coworker and I misread "A build step will copy the files in /src/views and /generated/templates/views to the same directory in the output." to mean that the typescript complier would automatically handle the merge of the specified folders, that is why I was looking for a combined output in the root of the output folder. Rereading it after your comments I see that it implies that the developer has added a build step to handle the folder merge. Thanks for clearing that up!