Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Liferay Angular Portlet - .jar size
While developing an Angular portlet I noticed that the build takes 2-6 minutes and results in a ~40MB .jar.
The only changes I made to the original template were in package.json. There I updated the dependencies to match a current Angular CLI project.
Are my build duration and size normal? Is there a way to optimize it?
The only changes I made to the original template were in package.json. There I updated the dependencies to match a current Angular CLI project.
{
"dependencies": {
"@angular/animations": "~8.2.14",
"@angular/cdk": "^8.2.3",
"@angular/common": "~8.2.14",
"@angular/compiler": "~8.2.14",
"@angular/core": "~8.2.14",
"@angular/forms": "~8.2.14",
"@angular/material": "^8.2.3",
"@angular/platform-browser": "~8.2.14",
"@angular/platform-browser-dynamic": "~8.2.14",
"@angular/router": "~8.2.14",
"@ngx-translate/core": "^11.0.1",
"core-js": "^2.5.1",
"hammerjs": "^2.0.8",
"rxjs": "~6.4.0",
"tslib": "^1.10.0",
"zone.js": "~0.9.1",
"webpack": "4.41.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.19",
"@angular/cli": "~8.3.19",
"@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~8.2.14",
"@types/node": "~8.9.4",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3",
"liferay-npm-bundler": "2.15.0"
},
"main": "lib/angular-loader.js",
"name": "liferay-angular8",
"scripts": {
"build": "tsc && liferay-npm-bundler"
},
"version": "1.0.0"
}
I already know that things got better after Liferay 7.0 (which I am using) but unfortunately I am stuck with it for now. Are my build duration and size normal? Is there a way to optimize it?
I wouldn't declare 40mb as a problem.
You have the jar, open it with a zip tool and see what's in it. That way you'll know where the space is.
Often times you get all kinds of NPM dependencies to deal with. It wouldn't surprise me if you see a lot of stuff in there that maybe you do or don't need.
You have the jar, open it with a zip tool and see what's in it. That way you'll know where the space is.
Often times you get all kinds of NPM dependencies to deal with. It wouldn't surprise me if you see a lot of stuff in there that maybe you do or don't need.
I really doubt that you need so many dependencies for runtime. For example, I don't think webpack is needed out of the scope of development, therefore it should be moved to devDependencies. I guess this may happen with others...
Once you decide which are dev and which runtime deps, you can also use exclusions (https://github.com/liferay/liferay-js-toolkit/wiki/.npmbundlerrc-file-reference#exclude) to get rid of unneeded files inside needed packages.
Once you decide which are dev and which runtime deps, you can also use exclusions (https://github.com/liferay/liferay-js-toolkit/wiki/.npmbundlerrc-file-reference#exclude) to get rid of unneeded files inside needed packages.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™