Closed ardatan closed 4 years ago
Heya, can you give us some more context about what you're doing please?
Off the top of my head there's nothing preventing you from reading the files from disk after the app is built, but I don't think that's what you want to do.
Is it possible to do something like this wih angular cli? https://webpack.js.org/api/node/#custom-file-systems
@ardatan no, that is not possible with Angular CLI right now. We're planning some support for file system manipulation in https://github.com/angular/devkit/pull/366, but don't have a design to share yet.
@ardatan no, that is not possible with Angular CLI right now. We're planning some support for file system manipulation in angular/devkit#366, but don't have a design to share yet.
Now that https://github.com/angular/devkit/pull/366 is done, we need to investigate if there's a way for users to manipulate the file system.
This is not exactly what you've been asking, but you might want to look into the Ionic Native project. They are using createProgram
from @angular/compiler-cli
to programmatically compile a custom Angular project in order to provide an Angular specific version of their Cordova Native API wrapper.
This allows them to make changes to the project files by providing some CustomTransformers. Granted, they make changes to the final TypeScript AST, not the compiled JS files, but from here, there's just a small step until the TS code is converted into the final JS (and I think that you should be able to also hook into this last part)
https://github.com/ionic-team/ionic-native/blob/v5.26.0/scripts/build/ngx.ts#L27-L31
@ardatan, can you give a little more context about what you're trying to accomplish? Are you trying to write a builder that wraps another builder, or is there some other motivation we're not understanding?
I was rewriting angular-meteor compilers to do AoT compilation inside Meteor build system. Meteor's build system handles all FS operations, caching and so on internally. Then I needed to call AoT compiler programatically inside Meteor. But I figured it out later. It was 2 years ago, though :) You can check this to see how I implemented it. https://github.com/Urigo/angular-meteor/blob/master/atmosphere-packages/angular-typescript-compiler/index.js#L328
Ok, thanks for being so responsive after such a long time! The compiler API isn't really supported for use cases outside the Angular CLI itself, it just happens to have been pretty stable for View Engine, Ivy may be a different story. Your workaround is probably the best solution for what you're trying to do.
@dgp1130 Actually it wasn't lack of support but it was lack of documentation.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
I need to get bundle programatically as string not a file. In other words ,is that possible to get bundle file content directly in node js?