Skip to content
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

test(ivy): add render3 integration tests #21557

Closed
wants to merge 1 commit into from

Conversation

marclaval
Copy link
Contributor

This PR adds two Hello World integration tests with the Render3 engine. They don't use the compiler yet, but they will be useful to track the size of a small application.
They implement the same Hello World application as the other integration tests.

The first one is using Rollup to create the bundle and targets the standard packages of @angular. Since they are not correctly tree-shakable, the bundle ends up at 56.6kB of minified code (15.3kB after gzip).

The second is a bit more hacky. It uses Closure Compiler and the Angular source code compiled to ES2015, in order to remove as much unused code as possible. With this setup, the bundle is only 6.6kB minified (3.1kB after gzip).

@marclaval marclaval added action: review The PR is still awaiting reviews from at least one requested reviewer comp: ivy labels Jan 16, 2018
Copy link
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall lgtm, just needs a bit of cleanup.

"hello_world__render3__closure": {
"master": {
"gzip7": {
"bundle": 3138
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove limits for gzip7 and gzip9. going forward we want to break builds only if uncompressed size changes by more than 1%

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,2 @@
find built/packages/core/src/render3/* -name '*.js' -exec sed -i '' -e "s/import '.\/ng_dev_mode';//g" {} \;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you document what this does and why do we do it this way?

I thought closure had a way to set the compilation constant via config so I'm not sure why we do this kind of search&replace. if there is a good reason for it, please document it in this file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is workaround for google/closure-compiler#1601 Can you include the link in a comment?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you see if you can get it work with

-D "ngDevMode$$module$built$packages$core$src$render3$ng_dev_mode=false"
-D "ngDevMode=false"

This should set the closure compiler vars and tree shake them, but I don't seem to be able to get it to work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment added. Due to this bug, I couldn't make it work either.

{
"name": "angular-integration",
"version": "0.0.0",
"license": "MIT",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add "private: true" plz

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"compilerOptions": {
"module": "es2015",
"moduleResolution": "node",
"strictNullChecks": true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace with "strict": true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"outDir": "../built/e2e",
"types": ["jasmine"],
// TODO(alexeagle): was required for Protractor 4.0.11
"skipLibCheck": true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add "strict": true ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

{
"name": "angular-integration",
"version": "0.0.0",
"license": "MIT",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"compilerOptions": {
"module": "es2015",
"moduleResolution": "node",
"strictNullChecks": true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace with "strict": true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@IgorMinar IgorMinar added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jan 18, 2018
@@ -0,0 +1,2 @@
find built/packages/core/src/render3/* -name '*.js' -exec sed -i '' -e "s/import '.\/ng_dev_mode';//g" {} \;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is workaround for google/closure-compiler#1601 Can you include the link in a comment?

--rewrite_polyfills=false
--jscomp_off=checkVars

node_modules/zone.js/dist/zone_externs.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused why do we need zone here. Render3 should have no dependency on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the leftover

"dependencies": {
"rxjs": "file:../../node_modules/rxjs",
"typescript": "file:../../node_modules/typescript",
"zone.js": "file:../../node_modules/zone.js"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there dep on rxjs if we don't need it? (Also zone.js)?

Why is there NO dep on core which is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed rxjs

For the Angular source code, this scenario doesn't use distributed packages but just the source transpiled to ES2015. It is copied into built folder before the build.

@marclaval marclaval added action: review The PR is still awaiting reviews from at least one requested reviewer and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jan 19, 2018
@marclaval
Copy link
Contributor Author

@IgorMinar @mhevery thanks for the reviews, I've updated the PR with your comments, please take another look

Copy link
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@IgorMinar IgorMinar added target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jan 19, 2018
@mhevery
Copy link
Contributor

mhevery commented Jan 19, 2018

@mhevery mhevery closed this in a0dc0a2 Jan 19, 2018
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants