-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Angular: Use ngtools/webpack instead of at-loader #7231
Conversation
If you have any hints on the EDIT: fixed, had to create a tsconfig especially for protractor 😢 |
1324873
to
827c653
Compare
@@ -40,6 +41,10 @@ module.exports = (options) => ({ | |||
}, | |||
module: { | |||
rules: [ | |||
{ | |||
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/, | |||
use: [ '@ngtools/webpack' ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
brave move 😉 😜
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha yes ! Please try if you see any performance issues I'll rollback of course 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sure 👍
Did you find any good performance change?
This also means that we will have to wait for angular-cli release cycle. v6 - ivy
promises a lot let us see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do some tests to see the build time but it seemed pretty much the same...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what matters is the time to compile when in hot reload mode for any changes to a file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 awesome so we do have lazy loading in V5
🎉 🎆
@@ -64,6 +69,11 @@ module.exports = (options) => ({ | |||
] | |||
}, | |||
plugins: [ | |||
new AngularCompilerPlugin({ | |||
mainPath: utils.root('src/main/webapp/app/app.main.ts'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<%= MAIN_SRC_DIR %>
@@ -61,7 +61,7 @@ module.exports = (WATCH) => ({ | |||
test: /src[/|\\]main[/|\\]webapp[/|\\].+\.ts$/, | |||
enforce: 'post', | |||
exclude: /node_modules/, | |||
loader: 'sourcemap-istanbul-instrumenter-loader?force-sourcemap=true' | |||
loader: 'istanbul-instrumenter-loader?force-sourcemap=true&esModules=true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you change this to use syntax ?
"lint": [{ | ||
"project": "../../../tsconfig.json" | ||
}, | ||
"lint": [ | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you try to lint this like the deleted line above ?
@@ -78,6 +78,7 @@ | |||
"html-loader": "0.5.0", | |||
"html-webpack-plugin": "3.0.0", | |||
"husky": "0.14.3", | |||
"istanbul-instrumenter-loader": "3.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.0.0
doesn't support webpack 4 right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't have issue about this...
{ | ||
test: /\.ts$/, | ||
loaders: [ | ||
'angular2-template-loader', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this dependency also removed from package.json ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope because we need it in the webpack.test :(
@@ -363,7 +363,6 @@ const expectedFiles = { | |||
`${CLIENT_TEST_SRC_DIR}spec/helpers/mock-state-storage.service.ts`, | |||
`${CLIENT_TEST_SRC_DIR}spec/helpers/spyobject.ts`, | |||
`${CLIENT_TEST_SRC_DIR}spec/test.module.ts`, | |||
'tsconfig-aot.json', | |||
'tsconfig.json', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tsconfig.e2e ?
Seems that I have an issue with the interceptors who are not shared in the lazy loaded module. I think the cause is maybe the |
@wmarques WDYT about this? Split this PR into 2, one to migrate to The first one will fix the |
@sendilkumarn Yep LGTM :) I'm also investigating the HttpClient issues. So should we close this PRand i'll do two others ? |
@sendilkumarn this PR will be about the ngtools usage, I'll create a new one for the lazy loading if that's ok for you |
@wmarques yeah sure no issues at all. Just split it. I think |
pinging @deepu105 |
@wmarques did you refactor the PR ? |
@sendilkumarn @wmarques last time I didn't want to switch as it was slow in development, please test with some 10-15 entities. Each code change was taking so long to compile while running yarn start as everything was being recompiled instead of incremental changes. IF that issue no longer exists and the difference in performance while using Yarn start is very minimal then I'm ok to switch Could you guys post some stats pre and post this change when using Yarn start |
Yep I'll try with a big project. Do you have a repo where I can test this kind of config ? |
Just use one of our travis builds, it has lot of entities. Use the build
script under the travis folder and generate a sample app and copy the
config from that
Thanks & Regards,
Deepu
…On Tue, Mar 6, 2018 at 10:04 AM, William Marques ***@***.***> wrote:
Yep I'll try with a big project. Do you have a repo where I can test this
kind of config ?
I don't have time tonight but tomorrow I'll check this and refactor the PR
to remove the lazy loading part. Thanks
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7231 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABDlF1rkBO4-pEp1QStWG_A0r_SklNalks5tblE6gaJpZM4ScThu>
.
|
I refactored the PR it should now only contains the ngtools part ! I'm testing it with a big application to check performances. EDIT: so I tried with the sample app in travis folder, and the dev workflow is very slow with |
can we try with ts-loader if we can ? It was also migrated to v4. |
Just finished to align the registry with JHipster v5: jhipster/jhipster-registry#251 @wmarques @sendilkumarn : do you think we should do the same for the registry too ? |
Pascal, its not very important for Registry at the moment.We can do it once
we figure out all the details later
Thanks & Regards,
Deepu
…On Fri, Mar 9, 2018 at 8:16 AM, Pascal Grimaud ***@***.***> wrote:
Just finished to align the registry with JHipster v5:
jhipster/jhipster-registry#251
<jhipster/jhipster-registry#251>
@wmarques <https://github.com/wmarques> @sendilkumarn
<https://github.com/sendilkumarn> : do you think we should do the same
for the registry too ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7231 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABDlFwyHvs8iF9SLZjC7yRliB9tsyPyDks5tcixXgaJpZM4ScThu>
.
|
@sendilkumarn You mean using ts-loader for the dev mode ? Or for dev and prod ? |
@wmarques @sendilkumarn seems like migrating to webpack 4 didn't give us any performance improvements and our tests seems to be slower now, so I'm worried about this so can we first do a benchmark? |
@wmarques also take a look at s-panferov/awesome-typescript-loader#497 |
Btw I can really see webpack performance improvement in React :) |
So with ts-loader, cache-loader, thread-loader and fork-ts-checker-webpack-plugin I got build times of 12 secs for React with few entities. The yarn start compilation is very fast as well, ~10s fisrt run and ~3s for a change, also everything including yarn start works so we can try the same for Angular as well and compare to ngtools for performance. |
@wmarques do you still want to do this? if so please benchmark this against the current setup with ts-loader first plz |
It's better to lazy load modules to reduce the main bundle size and avoid giving the user data he will probably never need.
In order to make the lazy loading work with webpack we have two choices:
angular-router-loader
for the dev config and@ngtools/webpack
for prod (with AOT)@ngtools/webpack
everywhereFor consistency and simplification I chose to use
@ngtools/webpack
everywhere except for the test configuration, I couldn't make it work... But I saw that we were using a fork of the "official"istanbul-instrumenter-loader
so I put in our dependencies the official loader and not the fork which doesn't seems maintained anymore.We can discuss this of course, I didn't see much performance issues using
@ngtools/webpack
in development mode.Please make sure the below checklist is followed for Pull Requests.
Travis tests are green
Tests are added where necessary
Documentation is added/updated where necessary
Coding Rules & Commit Guidelines as per our CONTRIBUTING.md document are followed