Open log2-hwan opened 7 years ago
Propaply because of this: https://github.com/angular/angular/pull/18966
NgcCliOptions
was part of @angular/tsc-wrapper
which doesn't exists anymore in angular ^5.x.x.
The same problem also with 5.0.0-rc.1
Angular 5 will introduce lots of changes... Possibly an AOT watch mode and more...
I'll try to explore and see what we can add/improve
This affects both awesome-typescript-loader and fork-ts-checker-webpack-plugin for Angular AOT builds, so, currently, in order to use Angular 5.0.0+, the only way forward is ngtools/webpack
const { AotPlugin } = require('@ngtools/webpack');
...
module: {
rules: [
{
test: /\.ts$/,
use: ['@ngtools/webpack']
},
'''
plugins: [
new AotPlugin({
tsConfigPath: 'tsconfig.aot.json',
skipCodeGeneration: false
}),
Angular 5.0.0 final is out :)
Bad news, they have changed the whole process, it's completely different.
They have watch mode built in the compiler now which changed everything... I'll have to assess it and see.
You can use @gregbown workaround for now.
It means that:
ngc-webpack
hooks you cant nowawesome-typescript-loader
, ts-loader
)OK, I'm trying to get to the best solution here and the situation is tricky and complex.
I'll need you input here
@ngtools
AOT plugin
awesome-typescript-loader
, ts-loader
)Nowdays, most of the features are in the @ngtools
plugin and the only things not in it are:
From a process perspective, ngc-webpack
plugin worked in 2 phases
This process has 2 major downsides:
@ngtools
plugin implements a virtual file system integrated with webpack so it can run the AOT compilation within the same webpack run and add files on the fly while compiling the application.
This plays nicely with the new AOT watch mode feature in the @angular/compiler-cli
.
To port ngc-webpack
to angular 5 a lot of work is required and it is also mandatory now to support AOT watch mode, its worthless without.
And still, i18n is missing and some other stuff.
Here are the options, as I see them:
@ngtools
AOT plugin and patch it to support hooks (no dedicated TS loader)
This should be seamless to the user and with time try to push (3) below and deprecate the library. (only issue I see is lazy routes)@ngtools
plugin with the hooks (no dedicated TS loader) and deprecate the library.Now, i'd like to hear from you:
@ngtools
plugin getting more and more complex, isn't it risky to relay on a non-official AOT plugin?ngc-webpack
?If you want to use
TS Transformer API
I assume@ngtools
will allow adding it externally at some point...
cc @gdi2290
Well for now I will use it like this: https://ibb.co/m7eYfw
@MADzO is it really possible?
@Ks89 Yes it is... not ideal solution but working :)
@MADzO probably it works. But it's terrible solution. Better stay several more days on Angular 4 if it is not super critical.
Well, the solution is not optimal but not so bad.
Reason is, the compilation is done by angular/compiler and the angular/compiler-cli is just the engine that runs it.
So yes, there are thing happening there which are important like summery files, factory etc ... but it should be fine as you use something farily recent.
For now it should probably do the trick until I push the fix
@shlomiassaf Thank for you interest in this project and to try to update it to support Angular 5. It's really appreciated.
@shlomiassaf - Thanks for sharing details. Also, Can you please share the plan to push these fixes. Do let me know if I can help you on this!!
Hi guys,
Thank you all for the support!
I have refactored ngc-webpack
to support angular 5 using @ngtools/webpack
instead of @angular/compiler-cli
, this allows keeping the extra features in ngc-webpack
with full support for all @ngtools/webpack
features.
It will also allow easy migration to/from @ngtools/webpack
Please see the readme for more details.
Use ngc-webpack@4.0.0
Thanks!
@shlomiassaf - Thanks, Buddy!! Let me try it and get back to you with the result!!
I have some question? 1) Is it mandatory to install angular/cli to use ngtools/webpack? 2) Is angular2-template-loader required? 3) Is HMR working with angularclass/hmr-loader also with ngtools/webpack? 4) And how to configure ng-router-loader (for instance genDir)
I never used ngtools. Please, could you provide an example, for instance with a pull request to angularclass starter? Because I cannot use it. I'm able to build, but when I try to run it I get this error:
Uncaught ReferenceError: __decorate is not defined
Pushing this to angular-starter will take some time because it requires rearranging the plugins and loaders to be efficient.
Running it however should be an issue.
The test
directory has a webpack config it uses to init the tests
https://github.com/shlomiassaf/ngc-webpack/blob/master/test/testing/buildConfig/webpack.plugin-full.js
Follow it from there to the base webpack config to get a clue on a valid setup
@shlomiassaf add @ngtools/webpack
to install string in readme
@shlomiassaf first of all, thank you for the update of angular-starter by angularclass. I have a question, probably stupid, but I will try.
ngc-webpack supports multiple entry point (for instance 2 spa applications (main and admin))?
@Ks89 ngc-webpack
is just a proxy to @ngtools/webpack
with some extensibility features added.
So, if @ngtools/webpack
supports it so does ngc-webpack
, best way to look is in the angular cli docs.
If it works there but not with ngc-webpack
it's probably something that are required to setup in the angular starter project.
Let me know if this is the case.
@shlomiassaf no way for custom ts loaders here? tried to update medium size project (~70-80k loc) to ng5 from ng4 and got x2 prod build time (x3 with all build optimizations from angular team). ng4 build uses ngc-webpack + ts-loader + thread-loader
, ng5 - @ngtools/webpack
. Or maybe any way to get only components factories from ngc without compiled ts code..
Seems angular team changed @angular/compiler-cli API since 5.0.0-rc.0.