angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Angular 10. CommonJS or AMD dependencies can cause optimization bailouts

Open alekcey0211 opened this issue 6 years ago • 26 comments

After update to angular 10. I got this warning.

WARNING in ...\projects\client\src\app\localization.ts depends on devextreme/localization/globalize/date. CommonJS or AMD dependencies can cause optimization bailouts.

after read link "https://angular.io/guide/build#configuring-commonjs-dependencies" i made this

	"build": {
		"builder": "@angular-devkit/build-ng-packagr:build",
		"options": {
			"allowedCommonJsDependencies": [
				"lodash",
				"devextreme-angular",
				"devextreme",
				"@firebase",
				"@angular/fire",
				"devexpress-richedit",
				"x-data-spreadsheet"
			],
			"tsConfig": "projects/core/tsconfig.lib.json",
			"project": "projects/core/ng-package.json"
		}
	}

But this don`t help me.

What i doing wrong?

alekcey0211 avatar Jun 25 '20 12:06 alekcey0211

@PBartrina Not yet, tbh I was not looking into it, cause the alert message it is not a problem yet, but definitelyit is something that im gonna look into next week

guisperandio avatar Oct 02 '20 10:10 guisperandio

How can I know which import will cause "CommonJS or AMD dependencies can cause optimization bailouts."?

When I

import { map } from 'rxjs/operators'

Everything works well, but when I

 import { map } from 'rxjs/internal/operators'

This warning is show, but I can't see the reason.

UchihaYuki avatar Oct 16 '20 14:10 UchihaYuki

How can I know which import will cause "CommonJS or AMD dependencies can cause optimization bailouts."?

When I

import { map } from 'rxjs/operators'

Everything works well, but when I

 import { map } from 'rxjs/internal/operators'

This warning is show, but I can't see the reason.

You can find a good explanation here - https://stackoverflow.com/a/62604034/6097025

gunjankhanwilkar avatar Oct 20 '20 13:10 gunjankhanwilkar

@PBartrina I tested that today and the allowedCommonJsDependencies it is working with @angular-builders/custom-webpack:browser now

guisperandio avatar Oct 21 '20 11:10 guisperandio

@guisperandio Thanks for the update! <3

PBartrina avatar Oct 22 '20 09:10 PBartrina

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.